
#include "stdafx.h"
#include "Fugue.h"

namespace Fugue
{
    void Fugue384::TransformBytes_(byte* a_data, int a_index, int a_length)
    {
        a_data += a_index;
        a_length = a_length/4;

        uint row0, row1, row2, row3;
        uint col0, col1, col2, col3;
        uint tmp;
        int ptr = m_base;
        uint j1 = (4-m_base/9)%4;
        int j=0;

        if ((j1 != 0)&& (a_length != 0))
        {
            if  (j1 <= 1)         
            { 
                m_state[(-9*1+16+36)%36] ^= m_state[(-9*1+36)%36];
                m_state[(-9*1+36)%36] = ((uint*)a_data)[j];
                m_state[(-9*1+8+36)%36] ^= m_state[(-9*1+36)%36];
                m_state[(-9*1+1+36)%36] ^= m_state[(-9*1+27+36)%36];
                m_state[(-9*1+4+36)%36] ^= m_state[(-9*1+30+36)%36];
                m_state[((-3*(3*1+1))+36)%36] ^= m_state[((-3*(3*1+1))+4+36)%36];
                m_state[((-3*(3*1+1))+1+36)%36] ^= m_state[((-3*(3*1+1))+5+36)%36];
                m_state[((-3*(3*1+1))+2+36)%36] ^= m_state[((-3*(3*1+1))+6+36)%36];
                m_state[((-3*(3*1+1))+18+36)%36] ^= m_state[((-3*(3*1+1))+4+36)%36];
                m_state[((-3*(3*1+1))+19+36)%36] ^= m_state[((-3*(3*1+1))+5+36)%36];
                m_state[((-3*(3*1+1))+20+36)%36] ^= m_state[((-3*(3*1+1))+6+36)%36];
                col0 = col1 = col2 = col3 = 0;
                row0 = row1 = row2 = row3 = 0;
                tmp = aes_style_table0[(byte)(m_state[((-3*(3*1+1))+36)%36])];
                col0 = tmp;
                tmp = aes_style_table1[(byte)(m_state[((-3*(3*1+1))+36)%36]>>8)];
                row1 = tmp;
                col0 ^= tmp;
                tmp = aes_style_table2[(byte)(m_state[((-3*(3*1+1))+36)%36]>>16)];
                row2 = tmp;
                col0 ^= tmp;
                tmp = aes_style_table3[(byte)(m_state[((-3*(3*1+1))+36)%36]>>24)];
                row3 = tmp;
                col0 ^= tmp;
                tmp = aes_style_table0[(byte)(m_state[((-3*(3*1+1))+1+36)%36])];
                row0 = tmp;
                col1 = tmp;
                tmp = aes_style_table1[(byte)(m_state[((-3*(3*1+1))+1+36)%36]>>8)];
                col1 ^= tmp;
                tmp = aes_style_table2[(byte)(m_state[((-3*(3*1+1))+1+36)%36]>>16)];
                row2 ^= tmp;
                col1 ^= tmp;
                tmp = aes_style_table3[(byte)(m_state[((-3*(3*1+1))+1+36)%36]>>24)];
                row3 ^= tmp;
                col1 ^= tmp;
                tmp = aes_style_table0[(byte)(m_state[((-3*(3*1+1))+2+36)%36])];
                row0 ^= tmp;
                col2 = tmp;
                tmp = aes_style_table1[(byte)(m_state[((-3*(3*1+1))+2+36)%36]>>8)];
                row1 ^= tmp;
                col2 ^= tmp;
                tmp = aes_style_table2[(byte)(m_state[((-3*(3*1+1))+2+36)%36]>>16)];
                col2 ^= tmp;
                tmp = aes_style_table3[(byte)(m_state[((-3*(3*1+1))+2+36)%36]>>24)];
                row3 ^= tmp;
                col2 ^= tmp;
                tmp = aes_style_table0[(byte)(m_state[((-3*(3*1+1))+3+36)%36])];
                row0 ^= tmp;
                col3 = tmp;
                tmp = aes_style_table1[(byte)(m_state[((-3*(3*1+1))+3+36)%36]>>8)];
                row1 ^= tmp;
                col3 ^= tmp;
                tmp = aes_style_table2[(byte)(m_state[((-3*(3*1+1))+3+36)%36]>>16)];
                row2 ^= tmp;
                col3 ^= tmp;
                tmp = aes_style_table3[(byte)(m_state[((-3*(3*1+1))+3+36)%36]>>24)];
                col3 ^= tmp;
                m_state[((-3*(3*1+1))+36)%36]= ((row0^col0)&0x000000ff)^((row1^col1)&0x0000ff00)^((row2^col2)&0x00ff0000)^((row3^col3)&0xff000000);
                row0 = ((row0<<24)|(row0>>8));
                row1 = ((row1<<24)|(row1>>8));
                row2 = ((row2<<24)|(row2>>8));
                row3 = ((row3<<24)|(row3>>8));
                m_state[((-3*(3*1+1))+1+36)%36]= ((row0^col1)&0x000000ff)^((row1^col2)&0x0000ff00)^((row2^col3)&0x00ff0000)^((row3^col0)&0xff000000);
                row0 = ((row0<<24)|(row0>>8));
                row1 = ((row1<<24)|(row1>>8));
                row2 = ((row2<<24)|(row2>>8));
                row3 = ((row3<<24)|(row3>>8));
                m_state[((-3*(3*1+1))+2+36)%36]= ((row0^col2)&0x000000ff)^((row1^col3)&0x0000ff00)^((row2^col0)&0x00ff0000)^((row3^col1)&0xff000000);
                row0 = ((row0<<24)|(row0>>8));
                row1 = ((row1<<24)|(row1>>8));
                row2 = ((row2<<24)|(row2>>8));
                row3 = ((row3<<24)|(row3>>8));
                m_state[((-3*(3*1+1))+3+36)%36]= ((row0^col3)&0x000000ff)^((row1^col0)&0x0000ff00)^((row2^col1)&0x00ff0000)^((row3^col2)&0xff000000);
                m_state[((-3*(3*1+2))+36)%36] ^= m_state[((-3*(3*1+2))+4+36)%36];
                m_state[((-3*(3*1+2))+1+36)%36] ^= m_state[((-3*(3*1+2))+5+36)%36];
                m_state[((-3*(3*1+2))+2+36)%36] ^= m_state[((-3*(3*1+2))+6+36)%36];
                m_state[((-3*(3*1+2))+18+36)%36] ^= m_state[((-3*(3*1+2))+4+36)%36];
                m_state[((-3*(3*1+2))+19+36)%36] ^= m_state[((-3*(3*1+2))+5+36)%36];
                m_state[((-3*(3*1+2))+20+36)%36] ^= m_state[((-3*(3*1+2))+6+36)%36];
                col0 = col1 = col2 = col3 = 0;
                row0 = row1 = row2 = row3 = 0;
                tmp = aes_style_table0[(byte)(m_state[((-3*(3*1+2))+36)%36])];
                col0 = tmp;
                tmp = aes_style_table1[(byte)(m_state[((-3*(3*1+2))+36)%36]>>8)];
                row1 = tmp;
                col0 ^= tmp;
                tmp = aes_style_table2[(byte)(m_state[((-3*(3*1+2))+36)%36]>>16)];
                row2 = tmp;
                col0 ^= tmp;
                tmp = aes_style_table3[(byte)(m_state[((-3*(3*1+2))+36)%36]>>24)];
                row3 = tmp;
                col0 ^= tmp;
                tmp = aes_style_table0[(byte)(m_state[((-3*(3*1+2))+1+36)%36])];
                row0 = tmp;
                col1 = tmp;
                tmp = aes_style_table1[(byte)(m_state[((-3*(3*1+2))+1+36)%36]>>8)];
                col1 ^= tmp;
                tmp = aes_style_table2[(byte)(m_state[((-3*(3*1+2))+1+36)%36]>>16)];
                row2 ^= tmp;
                col1 ^= tmp;
                tmp = aes_style_table3[(byte)(m_state[((-3*(3*1+2))+1+36)%36]>>24)];
                row3 ^= tmp;
                col1 ^= tmp;
                tmp = aes_style_table0[(byte)(m_state[((-3*(3*1+2))+2+36)%36])];
                row0 ^= tmp;
                col2 = tmp;
                tmp = aes_style_table1[(byte)(m_state[((-3*(3*1+2))+2+36)%36]>>8)];
                row1 ^= tmp;
                col2 ^= tmp;
                tmp = aes_style_table2[(byte)(m_state[((-3*(3*1+2))+2+36)%36]>>16)];
                col2 ^= tmp;
                tmp = aes_style_table3[(byte)(m_state[((-3*(3*1+2))+2+36)%36]>>24)];
                row3 ^= tmp;
                col2 ^= tmp;
                tmp = aes_style_table0[(byte)(m_state[((-3*(3*1+2))+3+36)%36])];
                row0 ^= tmp;
                col3 = tmp;
                tmp = aes_style_table1[(byte)(m_state[((-3*(3*1+2))+3+36)%36]>>8)];
                row1 ^= tmp;
                col3 ^= tmp;
                tmp = aes_style_table2[(byte)(m_state[((-3*(3*1+2))+3+36)%36]>>16)];
                row2 ^= tmp;
                col3 ^= tmp;
                tmp = aes_style_table3[(byte)(m_state[((-3*(3*1+2))+3+36)%36]>>24)];
                col3 ^= tmp;
                m_state[((-3*(3*1+2))+36)%36]= ((row0^col0)&0x000000ff)^((row1^col1)&0x0000ff00)^((row2^col2)&0x00ff0000)^((row3^col3)&0xff000000);
                row0 = ((row0<<24)|(row0>>8));
                row1 = ((row1<<24)|(row1>>8));
                row2 = ((row2<<24)|(row2>>8));
                row3 = ((row3<<24)|(row3>>8));
                m_state[((-3*(3*1+2))+1+36)%36]= ((row0^col1)&0x000000ff)^((row1^col2)&0x0000ff00)^((row2^col3)&0x00ff0000)^((row3^col0)&0xff000000);
                row0 = ((row0<<24)|(row0>>8));
                row1 = ((row1<<24)|(row1>>8));
                row2 = ((row2<<24)|(row2>>8));
                row3 = ((row3<<24)|(row3>>8));
                m_state[((-3*(3*1+2))+2+36)%36]= ((row0^col2)&0x000000ff)^((row1^col3)&0x0000ff00)^((row2^col0)&0x00ff0000)^((row3^col1)&0xff000000);
                row0 = ((row0<<24)|(row0>>8));
                row1 = ((row1<<24)|(row1>>8));
                row2 = ((row2<<24)|(row2>>8));
                row3 = ((row3<<24)|(row3>>8));
                m_state[((-3*(3*1+2))+3+36)%36]= ((row0^col3)&0x000000ff)^((row1^col0)&0x0000ff00)^((row2^col1)&0x00ff0000)^((row3^col2)&0xff000000);
                m_state[((-3*(3*1+3))+36)%36] ^= m_state[((-3*(3*1+3))+4+36)%36];
                m_state[((-3*(3*1+3))+1+36)%36] ^= m_state[((-3*(3*1+3))+5+36)%36];
                m_state[((-3*(3*1+3))+2+36)%36] ^= m_state[((-3*(3*1+3))+6+36)%36];
                m_state[((-3*(3*1+3))+18+36)%36] ^= m_state[((-3*(3*1+3))+4+36)%36];
                m_state[((-3*(3*1+3))+19+36)%36] ^= m_state[((-3*(3*1+3))+5+36)%36];
                m_state[((-3*(3*1+3))+20+36)%36] ^= m_state[((-3*(3*1+3))+6+36)%36];
                col0 = col1 = col2 = col3 = 0;
                row0 = row1 = row2 = row3 = 0;
                tmp = aes_style_table0[(byte)(m_state[((-3*(3*1+3))+36)%36])];
                col0 = tmp;
                tmp = aes_style_table1[(byte)(m_state[((-3*(3*1+3))+36)%36]>>8)];
                row1 = tmp;
                col0 ^= tmp;
                tmp = aes_style_table2[(byte)(m_state[((-3*(3*1+3))+36)%36]>>16)];
                row2 = tmp;
                col0 ^= tmp;
                tmp = aes_style_table3[(byte)(m_state[((-3*(3*1+3))+36)%36]>>24)];
                row3 = tmp;
                col0 ^= tmp;
                tmp = aes_style_table0[(byte)(m_state[((-3*(3*1+3))+1+36)%36])];
                row0 = tmp;
                col1 = tmp;
                tmp = aes_style_table1[(byte)(m_state[((-3*(3*1+3))+1+36)%36]>>8)];
                col1 ^= tmp;
                tmp = aes_style_table2[(byte)(m_state[((-3*(3*1+3))+1+36)%36]>>16)];
                row2 ^= tmp;
                col1 ^= tmp;
                tmp = aes_style_table3[(byte)(m_state[((-3*(3*1+3))+1+36)%36]>>24)];
                row3 ^= tmp;
                col1 ^= tmp;
                tmp = aes_style_table0[(byte)(m_state[((-3*(3*1+3))+2+36)%36])];
                row0 ^= tmp;
                col2 = tmp;
                tmp = aes_style_table1[(byte)(m_state[((-3*(3*1+3))+2+36)%36]>>8)];
                row1 ^= tmp;
                col2 ^= tmp;
                tmp = aes_style_table2[(byte)(m_state[((-3*(3*1+3))+2+36)%36]>>16)];
                col2 ^= tmp;
                tmp = aes_style_table3[(byte)(m_state[((-3*(3*1+3))+2+36)%36]>>24)];
                row3 ^= tmp;
                col2 ^= tmp;
                tmp = aes_style_table0[(byte)(m_state[((-3*(3*1+3))+3+36)%36])];
                row0 ^= tmp;
                col3 = tmp;
                tmp = aes_style_table1[(byte)(m_state[((-3*(3*1+3))+3+36)%36]>>8)];
                row1 ^= tmp;
                col3 ^= tmp;
                tmp = aes_style_table2[(byte)(m_state[((-3*(3*1+3))+3+36)%36]>>16)];
                row2 ^= tmp;
                col3 ^= tmp;
                tmp = aes_style_table3[(byte)(m_state[((-3*(3*1+3))+3+36)%36]>>24)];
                col3 ^= tmp;
                m_state[((-3*(3*1+3))+36)%36]= ((row0^col0)&0x000000ff)^((row1^col1)&0x0000ff00)^((row2^col2)&0x00ff0000)^((row3^col3)&0xff000000);
                row0 = ((row0<<24)|(row0>>8));
                row1 = ((row1<<24)|(row1>>8));
                row2 = ((row2<<24)|(row2>>8));
                row3 = ((row3<<24)|(row3>>8));
                m_state[((-3*(3*1+3))+1+36)%36]= ((row0^col1)&0x000000ff)^((row1^col2)&0x0000ff00)^((row2^col3)&0x00ff0000)^((row3^col0)&0xff000000);
                row0 = ((row0<<24)|(row0>>8));
                row1 = ((row1<<24)|(row1>>8));
                row2 = ((row2<<24)|(row2>>8));
                row3 = ((row3<<24)|(row3>>8));
                m_state[((-3*(3*1+3))+2+36)%36]= ((row0^col2)&0x000000ff)^((row1^col3)&0x0000ff00)^((row2^col0)&0x00ff0000)^((row3^col1)&0xff000000);
                row0 = ((row0<<24)|(row0>>8));
                row1 = ((row1<<24)|(row1>>8));
                row2 = ((row2<<24)|(row2>>8));
                row3 = ((row3<<24)|(row3>>8));
                m_state[((-3*(3*1+3))+3+36)%36]= ((row0^col3)&0x000000ff)^((row1^col0)&0x0000ff00)^((row2^col1)&0x00ff0000)^((row3^col2)&0xff000000);

                j++;
                a_length--;
                ptr -=9;
            }

            if ((j1 <=2)&& (a_length != 0)) 
            { 
                m_state[(-9*2+16+36)%36] ^= m_state[(-9*2+36)%36];
                m_state[(-9*2+36)%36] = ((uint*)a_data)[j];
                m_state[(-9*2+8+36)%36] ^= m_state[(-9*2+36)%36];
                m_state[(-9*2+1+36)%36] ^= m_state[(-9*2+27+36)%36];
                m_state[(-9*2+4+36)%36] ^= m_state[(-9*2+30+36)%36];
                m_state[((-3*(3*2+1))+36)%36] ^= m_state[((-3*(3*2+1))+4+36)%36];

                m_state[((-3*(3*2+1))+1+36)%36] ^= m_state[((-3*(3*2+1))+5+36)%36];
                m_state[((-3*(3*2+1))+2+36)%36] ^= m_state[((-3*(3*2+1))+6+36)%36];
                m_state[((-3*(3*2+1))+18+36)%36] ^= m_state[((-3*(3*2+1))+4+36)%36];
                m_state[((-3*(3*2+1))+19+36)%36] ^= m_state[((-3*(3*2+1))+5+36)%36];
                m_state[((-3*(3*2+1))+20+36)%36] ^= m_state[((-3*(3*2+1))+6+36)%36];
                col0 = col1 = col2 = col3 = 0;
                row0 = row1 = row2 = row3 = 0;
                tmp = aes_style_table0[(byte)(m_state[((-3*(3*2+1))+36)%36])];
                col0 = tmp;
                tmp = aes_style_table1[(byte)(m_state[((-3*(3*2+1))+36)%36]>>8)];
                row1 = tmp;
                col0 ^= tmp;
                tmp = aes_style_table2[(byte)(m_state[((-3*(3*2+1))+36)%36]>>16)];
                row2 = tmp;
                col0 ^= tmp;
                tmp = aes_style_table3[(byte)(m_state[((-3*(3*2+1))+36)%36]>>24)];
                row3 = tmp;
                col0 ^= tmp;
                tmp = aes_style_table0[(byte)(m_state[((-3*(3*2+1))+1+36)%36])];
                row0 = tmp;
                col1 = tmp;
                tmp = aes_style_table1[(byte)(m_state[((-3*(3*2+1))+1+36)%36]>>8)];
                col1 ^= tmp;
                tmp = aes_style_table2[(byte)(m_state[((-3*(3*2+1))+1+36)%36]>>16)];
                row2 ^= tmp;
                col1 ^= tmp;
                tmp = aes_style_table3[(byte)(m_state[((-3*(3*2+1))+1+36)%36]>>24)];
                row3 ^= tmp;
                col1 ^= tmp;
                tmp = aes_style_table0[(byte)(m_state[((-3*(3*2+1))+2+36)%36])];
                row0 ^= tmp;
                col2 = tmp;
                tmp = aes_style_table1[(byte)(m_state[((-3*(3*2+1))+2+36)%36]>>8)];
                row1 ^= tmp;
                col2 ^= tmp;
                tmp = aes_style_table2[(byte)(m_state[((-3*(3*2+1))+2+36)%36]>>16)];
                col2 ^= tmp;
                tmp = aes_style_table3[(byte)(m_state[((-3*(3*2+1))+2+36)%36]>>24)];
                row3 ^= tmp;
                col2 ^= tmp;
                tmp = aes_style_table0[(byte)(m_state[((-3*(3*2+1))+3+36)%36])];
                row0 ^= tmp;
                col3 = tmp;
                tmp = aes_style_table1[(byte)(m_state[((-3*(3*2+1))+3+36)%36]>>8)];
                row1 ^= tmp;
                col3 ^= tmp;
                tmp = aes_style_table2[(byte)(m_state[((-3*(3*2+1))+3+36)%36]>>16)];
                row2 ^= tmp;
                col3 ^= tmp;
                tmp = aes_style_table3[(byte)(m_state[((-3*(3*2+1))+3+36)%36]>>24)];
                col3 ^= tmp;
                m_state[((-3*(3*2+1))+36)%36]= ((row0^col0)&0x000000ff)^((row1^col1)&0x0000ff00)^((row2^col2)&0x00ff0000)^((row3^col3)&0xff000000);
                row0 = ((row0<<24)|(row0>>8));
                row1 = ((row1<<24)|(row1>>8));
                row2 = ((row2<<24)|(row2>>8));
                row3 = ((row3<<24)|(row3>>8));
                m_state[((-3*(3*2+1))+1+36)%36]= ((row0^col1)&0x000000ff)^((row1^col2)&0x0000ff00)^((row2^col3)&0x00ff0000)^((row3^col0)&0xff000000);
                row0 = ((row0<<24)|(row0>>8));
                row1 = ((row1<<24)|(row1>>8));
                row2 = ((row2<<24)|(row2>>8));
                row3 = ((row3<<24)|(row3>>8));
                m_state[((-3*(3*2+1))+2+36)%36]= ((row0^col2)&0x000000ff)^((row1^col3)&0x0000ff00)^((row2^col0)&0x00ff0000)^((row3^col1)&0xff000000);
                row0 = ((row0<<24)|(row0>>8));
                row1 = ((row1<<24)|(row1>>8));
                row2 = ((row2<<24)|(row2>>8));
                row3 = ((row3<<24)|(row3>>8));
                m_state[((-3*(3*2+1))+3+36)%36]= ((row0^col3)&0x000000ff)^((row1^col0)&0x0000ff00)^((row2^col1)&0x00ff0000)^((row3^col2)&0xff000000);
                m_state[((-3*(3*2+2))+36)%36] ^= m_state[((-3*(3*2+2))+4+36)%36];
                m_state[((-3*(3*2+2))+1+36)%36] ^= m_state[((-3*(3*2+2))+5+36)%36];
                m_state[((-3*(3*2+2))+2+36)%36] ^= m_state[((-3*(3*2+2))+6+36)%36];
                m_state[((-3*(3*2+2))+18+36)%36] ^= m_state[((-3*(3*2+2))+4+36)%36];
                m_state[((-3*(3*2+2))+19+36)%36] ^= m_state[((-3*(3*2+2))+5+36)%36];
                m_state[((-3*(3*2+2))+20+36)%36] ^= m_state[((-3*(3*2+2))+6+36)%36];
                col0 = col1 = col2 = col3 = 0;
                row0 = row1 = row2 = row3 = 0;
                tmp = aes_style_table0[(byte)(m_state[((-3*(3*2+2))+36)%36])];
                col0 = tmp;
                tmp = aes_style_table1[(byte)(m_state[((-3*(3*2+2))+36)%36]>>8)];
                row1 = tmp;
                col0 ^= tmp;
                tmp = aes_style_table2[(byte)(m_state[((-3*(3*2+2))+36)%36]>>16)];
                row2 = tmp;
                col0 ^= tmp;
                tmp = aes_style_table3[(byte)(m_state[((-3*(3*2+2))+36)%36]>>24)];
                row3 = tmp;
                col0 ^= tmp;
                tmp = aes_style_table0[(byte)(m_state[((-3*(3*2+2))+1+36)%36])];
                row0 = tmp;
                col1 = tmp;
                tmp = aes_style_table1[(byte)(m_state[((-3*(3*2+2))+1+36)%36]>>8)];
                col1 ^= tmp;
                tmp = aes_style_table2[(byte)(m_state[((-3*(3*2+2))+1+36)%36]>>16)];
                row2 ^= tmp;
                col1 ^= tmp;
                tmp = aes_style_table3[(byte)(m_state[((-3*(3*2+2))+1+36)%36]>>24)];
                row3 ^= tmp;
                col1 ^= tmp;
                tmp = aes_style_table0[(byte)(m_state[((-3*(3*2+2))+2+36)%36])];
                row0 ^= tmp;
                col2 = tmp;
                tmp = aes_style_table1[(byte)(m_state[((-3*(3*2+2))+2+36)%36]>>8)];
                row1 ^= tmp;
                col2 ^= tmp;
                tmp = aes_style_table2[(byte)(m_state[((-3*(3*2+2))+2+36)%36]>>16)];
                col2 ^= tmp;
                tmp = aes_style_table3[(byte)(m_state[((-3*(3*2+2))+2+36)%36]>>24)];
                row3 ^= tmp;
                col2 ^= tmp;
                tmp = aes_style_table0[(byte)(m_state[((-3*(3*2+2))+3+36)%36])];
                row0 ^= tmp;
                col3 = tmp;
                tmp = aes_style_table1[(byte)(m_state[((-3*(3*2+2))+3+36)%36]>>8)];
                row1 ^= tmp;
                col3 ^= tmp;
                tmp = aes_style_table2[(byte)(m_state[((-3*(3*2+2))+3+36)%36]>>16)];
                row2 ^= tmp;
                col3 ^= tmp;
                tmp = aes_style_table3[(byte)(m_state[((-3*(3*2+2))+3+36)%36]>>24)];
                col3 ^= tmp;
                m_state[((-3*(3*2+2))+36)%36]= ((row0^col0)&0x000000ff)^((row1^col1)&0x0000ff00)^((row2^col2)&0x00ff0000)^((row3^col3)&0xff000000);
                row0 = ((row0<<24)|(row0>>8));
                row1 = ((row1<<24)|(row1>>8));
                row2 = ((row2<<24)|(row2>>8));
                row3 = ((row3<<24)|(row3>>8));
                m_state[((-3*(3*2+2))+1+36)%36]= ((row0^col1)&0x000000ff)^((row1^col2)&0x0000ff00)^((row2^col3)&0x00ff0000)^((row3^col0)&0xff000000);
                row0 = ((row0<<24)|(row0>>8));
                row1 = ((row1<<24)|(row1>>8));
                row2 = ((row2<<24)|(row2>>8));
                row3 = ((row3<<24)|(row3>>8));
                m_state[((-3*(3*2+2))+2+36)%36]= ((row0^col2)&0x000000ff)^((row1^col3)&0x0000ff00)^((row2^col0)&0x00ff0000)^((row3^col1)&0xff000000);
                row0 = ((row0<<24)|(row0>>8));
                row1 = ((row1<<24)|(row1>>8));
                row2 = ((row2<<24)|(row2>>8));
                row3 = ((row3<<24)|(row3>>8));
                m_state[((-3*(3*2+2))+3+36)%36]= ((row0^col3)&0x000000ff)^((row1^col0)&0x0000ff00)^((row2^col1)&0x00ff0000)^((row3^col2)&0xff000000);
                m_state[((-3*(3*2+3))+36)%36] ^= m_state[((-3*(3*2+3))+4+36)%36];
                m_state[((-3*(3*2+3))+1+36)%36] ^= m_state[((-3*(3*2+3))+5+36)%36];
                m_state[((-3*(3*2+3))+2+36)%36] ^= m_state[((-3*(3*2+3))+6+36)%36];
                m_state[((-3*(3*2+3))+18+36)%36] ^= m_state[((-3*(3*2+3))+4+36)%36];
                m_state[((-3*(3*2+3))+19+36)%36] ^= m_state[((-3*(3*2+3))+5+36)%36];
                m_state[((-3*(3*2+3))+20+36)%36] ^= m_state[((-3*(3*2+3))+6+36)%36];
                col0 = col1 = col2 = col3 = 0;
                row0 = row1 = row2 = row3 = 0;
                tmp = aes_style_table0[(byte)(m_state[((-3*(3*2+3))+36)%36])];
                col0 = tmp;
                tmp = aes_style_table1[(byte)(m_state[((-3*(3*2+3))+36)%36]>>8)];
                row1 = tmp;
                col0 ^= tmp;
                tmp = aes_style_table2[(byte)(m_state[((-3*(3*2+3))+36)%36]>>16)];
                row2 = tmp;
                col0 ^= tmp;
                tmp = aes_style_table3[(byte)(m_state[((-3*(3*2+3))+36)%36]>>24)];
                row3 = tmp;
                col0 ^= tmp;
                tmp = aes_style_table0[(byte)(m_state[((-3*(3*2+3))+1+36)%36])];
                row0 = tmp;
                col1 = tmp;
                tmp = aes_style_table1[(byte)(m_state[((-3*(3*2+3))+1+36)%36]>>8)];
                col1 ^= tmp;
                tmp = aes_style_table2[(byte)(m_state[((-3*(3*2+3))+1+36)%36]>>16)];
                row2 ^= tmp;
                col1 ^= tmp;
                tmp = aes_style_table3[(byte)(m_state[((-3*(3*2+3))+1+36)%36]>>24)];
                row3 ^= tmp;
                col1 ^= tmp;
                tmp = aes_style_table0[(byte)(m_state[((-3*(3*2+3))+2+36)%36])];
                row0 ^= tmp;
                col2 = tmp;
                tmp = aes_style_table1[(byte)(m_state[((-3*(3*2+3))+2+36)%36]>>8)];
                row1 ^= tmp;
                col2 ^= tmp;
                tmp = aes_style_table2[(byte)(m_state[((-3*(3*2+3))+2+36)%36]>>16)];
                col2 ^= tmp;
                tmp = aes_style_table3[(byte)(m_state[((-3*(3*2+3))+2+36)%36]>>24)];
                row3 ^= tmp;
                col2 ^= tmp;
                tmp = aes_style_table0[(byte)(m_state[((-3*(3*2+3))+3+36)%36])];
                row0 ^= tmp;
                col3 = tmp;
                tmp = aes_style_table1[(byte)(m_state[((-3*(3*2+3))+3+36)%36]>>8)];
                row1 ^= tmp;
                col3 ^= tmp;
                tmp = aes_style_table2[(byte)(m_state[((-3*(3*2+3))+3+36)%36]>>16)];
                row2 ^= tmp;
                col3 ^= tmp;
                tmp = aes_style_table3[(byte)(m_state[((-3*(3*2+3))+3+36)%36]>>24)];
                col3 ^= tmp;
                m_state[((-3*(3*2+3))+36)%36]= ((row0^col0)&0x000000ff)^((row1^col1)&0x0000ff00)^((row2^col2)&0x00ff0000)^((row3^col3)&0xff000000);
                row0 = ((row0<<24)|(row0>>8));
                row1 = ((row1<<24)|(row1>>8));
                row2 = ((row2<<24)|(row2>>8));
                row3 = ((row3<<24)|(row3>>8));
                m_state[((-3*(3*2+3))+1+36)%36]= ((row0^col1)&0x000000ff)^((row1^col2)&0x0000ff00)^((row2^col3)&0x00ff0000)^((row3^col0)&0xff000000);
                row0 = ((row0<<24)|(row0>>8));
                row1 = ((row1<<24)|(row1>>8));
                row2 = ((row2<<24)|(row2>>8));
                row3 = ((row3<<24)|(row3>>8));
                m_state[((-3*(3*2+3))+2+36)%36]= ((row0^col2)&0x000000ff)^((row1^col3)&0x0000ff00)^((row2^col0)&0x00ff0000)^((row3^col1)&0xff000000);
                row0 = ((row0<<24)|(row0>>8));
                row1 = ((row1<<24)|(row1>>8));
                row2 = ((row2<<24)|(row2>>8));
                row3 = ((row3<<24)|(row3>>8));
                m_state[((-3*(3*2+3))+3+36)%36]= ((row0^col3)&0x000000ff)^((row1^col0)&0x0000ff00)^((row2^col1)&0x00ff0000)^((row3^col2)&0xff000000);

                j++;
                a_length--;
                ptr -=9;
            }

            if ((j1 <= 3)&& (a_length != 0)) 
            { 
                m_state[(-9*3+16+36)%36] ^= m_state[(-9*3+36)%36];
                m_state[(-9*3+36)%36] = ((uint*)a_data)[j];
                m_state[(-9*3+8+36)%36] ^= m_state[(-9*3+36)%36];
                m_state[(-9*3+1+36)%36] ^= m_state[(-9*3+27+36)%36];
                m_state[(-9*3+4+36)%36] ^= m_state[(-9*3+30+36)%36];
                m_state[((-3*(3*3+1))+36)%36] ^= m_state[((-3*(3*3+1))+4+36)%36];
                m_state[((-3*(3*3+1))+1+36)%36] ^= m_state[((-3*(3*3+1))+5+36)%36];
                m_state[((-3*(3*3+1))+2+36)%36] ^= m_state[((-3*(3*3+1))+6+36)%36];
                m_state[((-3*(3*3+1))+18+36)%36] ^= m_state[((-3*(3*3+1))+4+36)%36];
                m_state[((-3*(3*3+1))+19+36)%36] ^= m_state[((-3*(3*3+1))+5+36)%36];
                m_state[((-3*(3*3+1))+20+36)%36] ^= m_state[((-3*(3*3+1))+6+36)%36];
                col0 = col1 = col2 = col3 = 0;
                row0 = row1 = row2 = row3 = 0;
                tmp = aes_style_table0[(byte)(m_state[((-3*(3*3+1))+36)%36])];
                col0 = tmp;
                tmp = aes_style_table1[(byte)(m_state[((-3*(3*3+1))+36)%36]>>8)];
                row1 = tmp;
                col0 ^= tmp;
                tmp = aes_style_table2[(byte)(m_state[((-3*(3*3+1))+36)%36]>>16)];
                row2 = tmp;
                col0 ^= tmp;
                tmp = aes_style_table3[(byte)(m_state[((-3*(3*3+1))+36)%36]>>24)];
                row3 = tmp;
                col0 ^= tmp;
                tmp = aes_style_table0[(byte)(m_state[((-3*(3*3+1))+1+36)%36])];
                row0 = tmp;
                col1 = tmp;
                tmp = aes_style_table1[(byte)(m_state[((-3*(3*3+1))+1+36)%36]>>8)];
                col1 ^= tmp;
                tmp = aes_style_table2[(byte)(m_state[((-3*(3*3+1))+1+36)%36]>>16)];
                row2 ^= tmp;
                col1 ^= tmp;
                tmp = aes_style_table3[(byte)(m_state[((-3*(3*3+1))+1+36)%36]>>24)];
                row3 ^= tmp;
                col1 ^= tmp;
                tmp = aes_style_table0[(byte)(m_state[((-3*(3*3+1))+2+36)%36])];
                row0 ^= tmp;
                col2 = tmp;
                tmp = aes_style_table1[(byte)(m_state[((-3*(3*3+1))+2+36)%36]>>8)];
                row1 ^= tmp;
                col2 ^= tmp;
                tmp = aes_style_table2[(byte)(m_state[((-3*(3*3+1))+2+36)%36]>>16)];
                col2 ^= tmp;
                tmp = aes_style_table3[(byte)(m_state[((-3*(3*3+1))+2+36)%36]>>24)];
                row3 ^= tmp;
                col2 ^= tmp;
                tmp = aes_style_table0[(byte)(m_state[((-3*(3*3+1))+3+36)%36])];
                row0 ^= tmp;
                col3 = tmp;
                tmp = aes_style_table1[(byte)(m_state[((-3*(3*3+1))+3+36)%36]>>8)];
                row1 ^= tmp;
                col3 ^= tmp;
                tmp = aes_style_table2[(byte)(m_state[((-3*(3*3+1))+3+36)%36]>>16)];
                row2 ^= tmp;
                col3 ^= tmp;
                tmp = aes_style_table3[(byte)(m_state[((-3*(3*3+1))+3+36)%36]>>24)];
                col3 ^= tmp;
                m_state[((-3*(3*3+1))+36)%36]= ((row0^col0)&0x000000ff)^((row1^col1)&0x0000ff00)^((row2^col2)&0x00ff0000)^((row3^col3)&0xff000000);
                row0 = ((row0<<24)|(row0>>8));
                row1 = ((row1<<24)|(row1>>8));
                row2 = ((row2<<24)|(row2>>8));
                row3 = ((row3<<24)|(row3>>8));
                m_state[((-3*(3*3+1))+1+36)%36]= ((row0^col1)&0x000000ff)^((row1^col2)&0x0000ff00)^((row2^col3)&0x00ff0000)^((row3^col0)&0xff000000);
                row0 = ((row0<<24)|(row0>>8));
                row1 = ((row1<<24)|(row1>>8));
                row2 = ((row2<<24)|(row2>>8));
                row3 = ((row3<<24)|(row3>>8));
                m_state[((-3*(3*3+1))+2+36)%36]= ((row0^col2)&0x000000ff)^((row1^col3)&0x0000ff00)^((row2^col0)&0x00ff0000)^((row3^col1)&0xff000000);
                row0 = ((row0<<24)|(row0>>8));
                row1 = ((row1<<24)|(row1>>8));
                row2 = ((row2<<24)|(row2>>8));
                row3 = ((row3<<24)|(row3>>8));
                m_state[((-3*(3*3+1))+3+36)%36]= ((row0^col3)&0x000000ff)^((row1^col0)&0x0000ff00)^((row2^col1)&0x00ff0000)^((row3^col2)&0xff000000);
                m_state[((-3*(3*3+2))+36)%36] ^= m_state[((-3*(3*3+2))+4+36)%36];
                m_state[((-3*(3*3+2))+1+36)%36] ^= m_state[((-3*(3*3+2))+5+36)%36];
                m_state[((-3*(3*3+2))+2+36)%36] ^= m_state[((-3*(3*3+2))+6+36)%36];
                m_state[((-3*(3*3+2))+18+36)%36] ^= m_state[((-3*(3*3+2))+4+36)%36];
                m_state[((-3*(3*3+2))+19+36)%36] ^= m_state[((-3*(3*3+2))+5+36)%36];
                m_state[((-3*(3*3+2))+20+36)%36] ^= m_state[((-3*(3*3+2))+6+36)%36];
                col0 = col1 = col2 = col3 = 0;
                row0 = row1 = row2 = row3 = 0;
                tmp = aes_style_table0[(byte)(m_state[((-3*(3*3+2))+36)%36])];
                col0 = tmp;
                tmp = aes_style_table1[(byte)(m_state[((-3*(3*3+2))+36)%36]>>8)];
                row1 = tmp;
                col0 ^= tmp;
                tmp = aes_style_table2[(byte)(m_state[((-3*(3*3+2))+36)%36]>>16)];
                row2 = tmp;
                col0 ^= tmp;
                tmp = aes_style_table3[(byte)(m_state[((-3*(3*3+2))+36)%36]>>24)];
                row3 = tmp;
                col0 ^= tmp;
                tmp = aes_style_table0[(byte)(m_state[((-3*(3*3+2))+1+36)%36])];
                row0 = tmp;
                col1 = tmp;
                tmp = aes_style_table1[(byte)(m_state[((-3*(3*3+2))+1+36)%36]>>8)];
                col1 ^= tmp;
                tmp = aes_style_table2[(byte)(m_state[((-3*(3*3+2))+1+36)%36]>>16)];
                row2 ^= tmp;
                col1 ^= tmp;
                tmp = aes_style_table3[(byte)(m_state[((-3*(3*3+2))+1+36)%36]>>24)];
                row3 ^= tmp;
                col1 ^= tmp;
                tmp = aes_style_table0[(byte)(m_state[((-3*(3*3+2))+2+36)%36])];
                row0 ^= tmp;
                col2 = tmp;
                tmp = aes_style_table1[(byte)(m_state[((-3*(3*3+2))+2+36)%36]>>8)];
                row1 ^= tmp;
                col2 ^= tmp;
                tmp = aes_style_table2[(byte)(m_state[((-3*(3*3+2))+2+36)%36]>>16)];
                col2 ^= tmp;
                tmp = aes_style_table3[(byte)(m_state[((-3*(3*3+2))+2+36)%36]>>24)];
                row3 ^= tmp;
                col2 ^= tmp;
                tmp = aes_style_table0[(byte)(m_state[((-3*(3*3+2))+3+36)%36])];
                row0 ^= tmp;
                col3 = tmp;
                tmp = aes_style_table1[(byte)(m_state[((-3*(3*3+2))+3+36)%36]>>8)];
                row1 ^= tmp;
                col3 ^= tmp;
                tmp = aes_style_table2[(byte)(m_state[((-3*(3*3+2))+3+36)%36]>>16)];
                row2 ^= tmp;
                col3 ^= tmp;
                tmp = aes_style_table3[(byte)(m_state[((-3*(3*3+2))+3+36)%36]>>24)];
                col3 ^= tmp;
                m_state[((-3*(3*3+2))+36)%36]= ((row0^col0)&0x000000ff)^((row1^col1)&0x0000ff00)^((row2^col2)&0x00ff0000)^((row3^col3)&0xff000000);
                row0 = ((row0<<24)|(row0>>8));
                row1 = ((row1<<24)|(row1>>8));
                row2 = ((row2<<24)|(row2>>8));
                row3 = ((row3<<24)|(row3>>8));
                m_state[((-3*(3*3+2))+1+36)%36]= ((row0^col1)&0x000000ff)^((row1^col2)&0x0000ff00)^((row2^col3)&0x00ff0000)^((row3^col0)&0xff000000);
                row0 = ((row0<<24)|(row0>>8));
                row1 = ((row1<<24)|(row1>>8));
                row2 = ((row2<<24)|(row2>>8));
                row3 = ((row3<<24)|(row3>>8));
                m_state[((-3*(3*3+2))+2+36)%36]= ((row0^col2)&0x000000ff)^((row1^col3)&0x0000ff00)^((row2^col0)&0x00ff0000)^((row3^col1)&0xff000000);
                row0 = ((row0<<24)|(row0>>8));
                row1 = ((row1<<24)|(row1>>8));
                row2 = ((row2<<24)|(row2>>8));
                row3 = ((row3<<24)|(row3>>8));
                m_state[((-3*(3*3+2))+3+36)%36]= ((row0^col3)&0x000000ff)^((row1^col0)&0x0000ff00)^((row2^col1)&0x00ff0000)^((row3^col2)&0xff000000);
                m_state[((-3*(3*3+3))+36)%36] ^= m_state[((-3*(3*3+3))+4+36)%36];
                m_state[((-3*(3*3+3))+1+36)%36] ^= m_state[((-3*(3*3+3))+5+36)%36];
                m_state[((-3*(3*3+3))+2+36)%36] ^= m_state[((-3*(3*3+3))+6+36)%36];
                m_state[((-3*(3*3+3))+18+36)%36] ^= m_state[((-3*(3*3+3))+4+36)%36];
                m_state[((-3*(3*3+3))+19+36)%36] ^= m_state[((-3*(3*3+3))+5+36)%36];
                m_state[((-3*(3*3+3))+20+36)%36] ^= m_state[((-3*(3*3+3))+6+36)%36];
                col0 = col1 = col2 = col3 = 0;
                row0 = row1 = row2 = row3 = 0;
                tmp = aes_style_table0[(byte)(m_state[((-3*(3*3+3))+36)%36])];
                col0 = tmp;
                tmp = aes_style_table1[(byte)(m_state[((-3*(3*3+3))+36)%36]>>8)];
                row1 = tmp;
                col0 ^= tmp;
                tmp = aes_style_table2[(byte)(m_state[((-3*(3*3+3))+36)%36]>>16)];
                row2 = tmp;
                col0 ^= tmp;
                tmp = aes_style_table3[(byte)(m_state[((-3*(3*3+3))+36)%36]>>24)];
                row3 = tmp;
                col0 ^= tmp;
                tmp = aes_style_table0[(byte)(m_state[((-3*(3*3+3))+1+36)%36])];
                row0 = tmp;
                col1 = tmp;
                tmp = aes_style_table1[(byte)(m_state[((-3*(3*3+3))+1+36)%36]>>8)];
                col1 ^= tmp;
                tmp = aes_style_table2[(byte)(m_state[((-3*(3*3+3))+1+36)%36]>>16)];
                row2 ^= tmp;
                col1 ^= tmp;
                tmp = aes_style_table3[(byte)(m_state[((-3*(3*3+3))+1+36)%36]>>24)];
                row3 ^= tmp;
                col1 ^= tmp;
                tmp = aes_style_table0[(byte)(m_state[((-3*(3*3+3))+2+36)%36])];
                row0 ^= tmp;
                col2 = tmp;
                tmp = aes_style_table1[(byte)(m_state[((-3*(3*3+3))+2+36)%36]>>8)];
                row1 ^= tmp;
                col2 ^= tmp;
                tmp = aes_style_table2[(byte)(m_state[((-3*(3*3+3))+2+36)%36]>>16)];
                col2 ^= tmp;
                tmp = aes_style_table3[(byte)(m_state[((-3*(3*3+3))+2+36)%36]>>24)];
                row3 ^= tmp;
                col2 ^= tmp;
                tmp = aes_style_table0[(byte)(m_state[((-3*(3*3+3))+3+36)%36])];
                row0 ^= tmp;
                col3 = tmp;
                tmp = aes_style_table1[(byte)(m_state[((-3*(3*3+3))+3+36)%36]>>8)];
                row1 ^= tmp;
                col3 ^= tmp;
                tmp = aes_style_table2[(byte)(m_state[((-3*(3*3+3))+3+36)%36]>>16)];
                row2 ^= tmp;
                col3 ^= tmp;
                tmp = aes_style_table3[(byte)(m_state[((-3*(3*3+3))+3+36)%36]>>24)];
                col3 ^= tmp;
                m_state[((-3*(3*3+3))+36)%36]= ((row0^col0)&0x000000ff)^((row1^col1)&0x0000ff00)^((row2^col2)&0x00ff0000)^((row3^col3)&0xff000000);
                row0 = ((row0<<24)|(row0>>8));
                row1 = ((row1<<24)|(row1>>8));
                row2 = ((row2<<24)|(row2>>8));
                row3 = ((row3<<24)|(row3>>8));
                m_state[((-3*(3*3+3))+1+36)%36]= ((row0^col1)&0x000000ff)^((row1^col2)&0x0000ff00)^((row2^col3)&0x00ff0000)^((row3^col0)&0xff000000);
                row0 = ((row0<<24)|(row0>>8));
                row1 = ((row1<<24)|(row1>>8));
                row2 = ((row2<<24)|(row2>>8));
                row3 = ((row3<<24)|(row3>>8));
                m_state[((-3*(3*3+3))+2+36)%36]= ((row0^col2)&0x000000ff)^((row1^col3)&0x0000ff00)^((row2^col0)&0x00ff0000)^((row3^col1)&0xff000000);
                row0 = ((row0<<24)|(row0>>8));
                row1 = ((row1<<24)|(row1>>8));
                row2 = ((row2<<24)|(row2>>8));
                row3 = ((row3<<24)|(row3>>8));
                m_state[((-3*(3*3+3))+3+36)%36]= ((row0^col3)&0x000000ff)^((row1^col0)&0x0000ff00)^((row2^col1)&0x00ff0000)^((row3^col2)&0xff000000);

                j++;
                a_length--;
                ptr -=9;
            }
        }

        int len_mod = (a_length)%4;
        int len_div = (a_length)/4;

        for (int j2=0; j2<len_div; j2++)
        {
            m_state[(-9*0+16+36)%36] ^= m_state[(-9*0+36)%36];
            m_state[(-9*0+36)%36] = ((uint*)a_data)[j];
            m_state[(-9*0+8+36)%36] ^= m_state[(-9*0+36)%36];
            m_state[(-9*0+1+36)%36] ^= m_state[(-9*0+27+36)%36];
            m_state[(-9*0+4+36)%36] ^= m_state[(-9*0+30+36)%36];
            m_state[((-3*(3*0+1))+36)%36] ^= m_state[((-3*(3*0+1))+4+36)%36];
            m_state[((-3*(3*0+1))+1+36)%36] ^= m_state[((-3*(3*0+1))+5+36)%36];
            m_state[((-3*(3*0+1))+2+36)%36] ^= m_state[((-3*(3*0+1))+6+36)%36];
            m_state[((-3*(3*0+1))+18+36)%36] ^= m_state[((-3*(3*0+1))+4+36)%36];
            m_state[((-3*(3*0+1))+19+36)%36] ^= m_state[((-3*(3*0+1))+5+36)%36];
            m_state[((-3*(3*0+1))+20+36)%36] ^= m_state[((-3*(3*0+1))+6+36)%36];
            col0 = col1 = col2 = col3 = 0;
            row0 = row1 = row2 = row3 = 0;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*0+1))+36)%36])];
            col0 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*0+1))+36)%36]>>8)];
            row1 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*0+1))+36)%36]>>16)];
            row2 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*0+1))+36)%36]>>24)];
            row3 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*0+1))+1+36)%36])];
            row0 = tmp;
            col1 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*0+1))+1+36)%36]>>8)];
            col1 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*0+1))+1+36)%36]>>16)];
            row2 ^= tmp;
            col1 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*0+1))+1+36)%36]>>24)];
            row3 ^= tmp;
            col1 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*0+1))+2+36)%36])];
            row0 ^= tmp;
            col2 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*0+1))+2+36)%36]>>8)];
            row1 ^= tmp;
            col2 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*0+1))+2+36)%36]>>16)];
            col2 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*0+1))+2+36)%36]>>24)];
            row3 ^= tmp;
            col2 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*0+1))+3+36)%36])];
            row0 ^= tmp;
            col3 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*0+1))+3+36)%36]>>8)];
            row1 ^= tmp;
            col3 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*0+1))+3+36)%36]>>16)];
            row2 ^= tmp;
            col3 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*0+1))+3+36)%36]>>24)];
            col3 ^= tmp;
            m_state[((-3*(3*0+1))+36)%36]= ((row0^col0)&0x000000ff)^((row1^col1)&0x0000ff00)^((row2^col2)&0x00ff0000)^((row3^col3)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[((-3*(3*0+1))+1+36)%36]= ((row0^col1)&0x000000ff)^((row1^col2)&0x0000ff00)^((row2^col3)&0x00ff0000)^((row3^col0)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[((-3*(3*0+1))+2+36)%36]= ((row0^col2)&0x000000ff)^((row1^col3)&0x0000ff00)^((row2^col0)&0x00ff0000)^((row3^col1)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[((-3*(3*0+1))+3+36)%36]= ((row0^col3)&0x000000ff)^((row1^col0)&0x0000ff00)^((row2^col1)&0x00ff0000)^((row3^col2)&0xff000000);
            m_state[((-3*(3*0+2))+36)%36] ^= m_state[((-3*(3*0+2))+4+36)%36];
            m_state[((-3*(3*0+2))+1+36)%36] ^= m_state[((-3*(3*0+2))+5+36)%36];
            m_state[((-3*(3*0+2))+2+36)%36] ^= m_state[((-3*(3*0+2))+6+36)%36];
            m_state[((-3*(3*0+2))+18+36)%36] ^= m_state[((-3*(3*0+2))+4+36)%36];
            m_state[((-3*(3*0+2))+19+36)%36] ^= m_state[((-3*(3*0+2))+5+36)%36];
            m_state[((-3*(3*0+2))+20+36)%36] ^= m_state[((-3*(3*0+2))+6+36)%36];
            col0 = col1 = col2 = col3 = 0;
            row0 = row1 = row2 = row3 = 0;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*0+2))+36)%36])];
            col0 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*0+2))+36)%36]>>8)];
            row1 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*0+2))+36)%36]>>16)];
            row2 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*0+2))+36)%36]>>24)];
            row3 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*0+2))+1+36)%36])];
            row0 = tmp;
            col1 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*0+2))+1+36)%36]>>8)];
            col1 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*0+2))+1+36)%36]>>16)];
            row2 ^= tmp;
            col1 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*0+2))+1+36)%36]>>24)];
            row3 ^= tmp;
            col1 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*0+2))+2+36)%36])];
            row0 ^= tmp;
            col2 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*0+2))+2+36)%36]>>8)];
            row1 ^= tmp;
            col2 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*0+2))+2+36)%36]>>16)];
            col2 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*0+2))+2+36)%36]>>24)];
            row3 ^= tmp;
            col2 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*0+2))+3+36)%36])];
            row0 ^= tmp;
            col3 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*0+2))+3+36)%36]>>8)];
            row1 ^= tmp;
            col3 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*0+2))+3+36)%36]>>16)];
            row2 ^= tmp;
            col3 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*0+2))+3+36)%36]>>24)];
            col3 ^= tmp;
            m_state[((-3*(3*0+2))+36)%36]= ((row0^col0)&0x000000ff)^((row1^col1)&0x0000ff00)^((row2^col2)&0x00ff0000)^((row3^col3)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[((-3*(3*0+2))+1+36)%36]= ((row0^col1)&0x000000ff)^((row1^col2)&0x0000ff00)^((row2^col3)&0x00ff0000)^((row3^col0)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[((-3*(3*0+2))+2+36)%36]= ((row0^col2)&0x000000ff)^((row1^col3)&0x0000ff00)^((row2^col0)&0x00ff0000)^((row3^col1)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[((-3*(3*0+2))+3+36)%36]= ((row0^col3)&0x000000ff)^((row1^col0)&0x0000ff00)^((row2^col1)&0x00ff0000)^((row3^col2)&0xff000000);
            m_state[((-3*(3*0+3))+36)%36] ^= m_state[((-3*(3*0+3))+4+36)%36];
            m_state[((-3*(3*0+3))+1+36)%36] ^= m_state[((-3*(3*0+3))+5+36)%36];
            m_state[((-3*(3*0+3))+2+36)%36] ^= m_state[((-3*(3*0+3))+6+36)%36];
            m_state[((-3*(3*0+3))+18+36)%36] ^= m_state[((-3*(3*0+3))+4+36)%36];
            m_state[((-3*(3*0+3))+19+36)%36] ^= m_state[((-3*(3*0+3))+5+36)%36];
            m_state[((-3*(3*0+3))+20+36)%36] ^= m_state[((-3*(3*0+3))+6+36)%36];
            col0 = col1 = col2 = col3 = 0;
            row0 = row1 = row2 = row3 = 0;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*0+3))+36)%36])];
            col0 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*0+3))+36)%36]>>8)];
            row1 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*0+3))+36)%36]>>16)];
            row2 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*0+3))+36)%36]>>24)];
            row3 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*0+3))+1+36)%36])];
            row0 = tmp;
            col1 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*0+3))+1+36)%36]>>8)];
            col1 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*0+3))+1+36)%36]>>16)];
            row2 ^= tmp;
            col1 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*0+3))+1+36)%36]>>24)];
            row3 ^= tmp;
            col1 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*0+3))+2+36)%36])];
            row0 ^= tmp;
            col2 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*0+3))+2+36)%36]>>8)];
            row1 ^= tmp;
            col2 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*0+3))+2+36)%36]>>16)];
            col2 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*0+3))+2+36)%36]>>24)];
            row3 ^= tmp;
            col2 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*0+3))+3+36)%36])];
            row0 ^= tmp;
            col3 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*0+3))+3+36)%36]>>8)];
            row1 ^= tmp;
            col3 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*0+3))+3+36)%36]>>16)];
            row2 ^= tmp;
            col3 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*0+3))+3+36)%36]>>24)];
            col3 ^= tmp;
            m_state[((-3*(3*0+3))+36)%36]= ((row0^col0)&0x000000ff)^((row1^col1)&0x0000ff00)^((row2^col2)&0x00ff0000)^((row3^col3)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[((-3*(3*0+3))+1+36)%36]= ((row0^col1)&0x000000ff)^((row1^col2)&0x0000ff00)^((row2^col3)&0x00ff0000)^((row3^col0)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[((-3*(3*0+3))+2+36)%36]= ((row0^col2)&0x000000ff)^((row1^col3)&0x0000ff00)^((row2^col0)&0x00ff0000)^((row3^col1)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[((-3*(3*0+3))+3+36)%36]= ((row0^col3)&0x000000ff)^((row1^col0)&0x0000ff00)^((row2^col1)&0x00ff0000)^((row3^col2)&0xff000000);

            j++;

            m_state[(-9*1+16+36)%36] ^= m_state[(-9*1+36)%36];
            m_state[(-9*1+36)%36] = ((uint*)a_data)[j];
            m_state[(-9*1+8+36)%36] ^= m_state[(-9*1+36)%36];
            m_state[(-9*1+1+36)%36] ^= m_state[(-9*1+27+36)%36];
            m_state[(-9*1+4+36)%36] ^= m_state[(-9*1+30+36)%36];
            m_state[((-3*(3*1+1))+36)%36] ^= m_state[((-3*(3*1+1))+4+36)%36];
            m_state[((-3*(3*1+1))+1+36)%36] ^= m_state[((-3*(3*1+1))+5+36)%36];
            m_state[((-3*(3*1+1))+2+36)%36] ^= m_state[((-3*(3*1+1))+6+36)%36];
            m_state[((-3*(3*1+1))+18+36)%36] ^= m_state[((-3*(3*1+1))+4+36)%36];
            m_state[((-3*(3*1+1))+19+36)%36] ^= m_state[((-3*(3*1+1))+5+36)%36];
            m_state[((-3*(3*1+1))+20+36)%36] ^= m_state[((-3*(3*1+1))+6+36)%36];
            col0 = col1 = col2 = col3 = 0;
            row0 = row1 = row2 = row3 = 0;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*1+1))+36)%36])];
            col0 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*1+1))+36)%36]>>8)];
            row1 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*1+1))+36)%36]>>16)];
            row2 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*1+1))+36)%36]>>24)];
            row3 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*1+1))+1+36)%36])];
            row0 = tmp;
            col1 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*1+1))+1+36)%36]>>8)];
            col1 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*1+1))+1+36)%36]>>16)];
            row2 ^= tmp;
            col1 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*1+1))+1+36)%36]>>24)];
            row3 ^= tmp;
            col1 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*1+1))+2+36)%36])];
            row0 ^= tmp;
            col2 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*1+1))+2+36)%36]>>8)];
            row1 ^= tmp;
            col2 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*1+1))+2+36)%36]>>16)];
            col2 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*1+1))+2+36)%36]>>24)];
            row3 ^= tmp;
            col2 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*1+1))+3+36)%36])];
            row0 ^= tmp;
            col3 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*1+1))+3+36)%36]>>8)];
            row1 ^= tmp;
            col3 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*1+1))+3+36)%36]>>16)];
            row2 ^= tmp;
            col3 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*1+1))+3+36)%36]>>24)];
            col3 ^= tmp;
            m_state[((-3*(3*1+1))+36)%36]= ((row0^col0)&0x000000ff)^((row1^col1)&0x0000ff00)^((row2^col2)&0x00ff0000)^((row3^col3)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[((-3*(3*1+1))+1+36)%36]= ((row0^col1)&0x000000ff)^((row1^col2)&0x0000ff00)^((row2^col3)&0x00ff0000)^((row3^col0)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[((-3*(3*1+1))+2+36)%36]= ((row0^col2)&0x000000ff)^((row1^col3)&0x0000ff00)^((row2^col0)&0x00ff0000)^((row3^col1)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[((-3*(3*1+1))+3+36)%36]= ((row0^col3)&0x000000ff)^((row1^col0)&0x0000ff00)^((row2^col1)&0x00ff0000)^((row3^col2)&0xff000000);
            m_state[((-3*(3*1+2))+36)%36] ^= m_state[((-3*(3*1+2))+4+36)%36];
            m_state[((-3*(3*1+2))+1+36)%36] ^= m_state[((-3*(3*1+2))+5+36)%36];
            m_state[((-3*(3*1+2))+2+36)%36] ^= m_state[((-3*(3*1+2))+6+36)%36];
            m_state[((-3*(3*1+2))+18+36)%36] ^= m_state[((-3*(3*1+2))+4+36)%36];
            m_state[((-3*(3*1+2))+19+36)%36] ^= m_state[((-3*(3*1+2))+5+36)%36];
            m_state[((-3*(3*1+2))+20+36)%36] ^= m_state[((-3*(3*1+2))+6+36)%36];
            col0 = col1 = col2 = col3 = 0;
            row0 = row1 = row2 = row3 = 0;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*1+2))+36)%36])];
            col0 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*1+2))+36)%36]>>8)];
            row1 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*1+2))+36)%36]>>16)];
            row2 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*1+2))+36)%36]>>24)];
            row3 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*1+2))+1+36)%36])];
            row0 = tmp;
            col1 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*1+2))+1+36)%36]>>8)];
            col1 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*1+2))+1+36)%36]>>16)];
            row2 ^= tmp;
            col1 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*1+2))+1+36)%36]>>24)];
            row3 ^= tmp;
            col1 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*1+2))+2+36)%36])];
            row0 ^= tmp;
            col2 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*1+2))+2+36)%36]>>8)];
            row1 ^= tmp;
            col2 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*1+2))+2+36)%36]>>16)];
            col2 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*1+2))+2+36)%36]>>24)];
            row3 ^= tmp;
            col2 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*1+2))+3+36)%36])];
            row0 ^= tmp;
            col3 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*1+2))+3+36)%36]>>8)];
            row1 ^= tmp;
            col3 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*1+2))+3+36)%36]>>16)];
            row2 ^= tmp;
            col3 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*1+2))+3+36)%36]>>24)];
            col3 ^= tmp;
            m_state[((-3*(3*1+2))+36)%36]= ((row0^col0)&0x000000ff)^((row1^col1)&0x0000ff00)^((row2^col2)&0x00ff0000)^((row3^col3)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[((-3*(3*1+2))+1+36)%36]= ((row0^col1)&0x000000ff)^((row1^col2)&0x0000ff00)^((row2^col3)&0x00ff0000)^((row3^col0)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[((-3*(3*1+2))+2+36)%36]= ((row0^col2)&0x000000ff)^((row1^col3)&0x0000ff00)^((row2^col0)&0x00ff0000)^((row3^col1)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[((-3*(3*1+2))+3+36)%36]= ((row0^col3)&0x000000ff)^((row1^col0)&0x0000ff00)^((row2^col1)&0x00ff0000)^((row3^col2)&0xff000000);
            m_state[((-3*(3*1+3))+36)%36] ^= m_state[((-3*(3*1+3))+4+36)%36];
            m_state[((-3*(3*1+3))+1+36)%36] ^= m_state[((-3*(3*1+3))+5+36)%36];
            m_state[((-3*(3*1+3))+2+36)%36] ^= m_state[((-3*(3*1+3))+6+36)%36];
            m_state[((-3*(3*1+3))+18+36)%36] ^= m_state[((-3*(3*1+3))+4+36)%36];
            m_state[((-3*(3*1+3))+19+36)%36] ^= m_state[((-3*(3*1+3))+5+36)%36];
            m_state[((-3*(3*1+3))+20+36)%36] ^= m_state[((-3*(3*1+3))+6+36)%36];
            col0 = col1 = col2 = col3 = 0;
            row0 = row1 = row2 = row3 = 0;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*1+3))+36)%36])];
            col0 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*1+3))+36)%36]>>8)];
            row1 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*1+3))+36)%36]>>16)];
            row2 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*1+3))+36)%36]>>24)];
            row3 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*1+3))+1+36)%36])];
            row0 = tmp;
            col1 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*1+3))+1+36)%36]>>8)];
            col1 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*1+3))+1+36)%36]>>16)];
            row2 ^= tmp;
            col1 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*1+3))+1+36)%36]>>24)];
            row3 ^= tmp;
            col1 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*1+3))+2+36)%36])];
            row0 ^= tmp;
            col2 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*1+3))+2+36)%36]>>8)];
            row1 ^= tmp;
            col2 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*1+3))+2+36)%36]>>16)];
            col2 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*1+3))+2+36)%36]>>24)];
            row3 ^= tmp;
            col2 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*1+3))+3+36)%36])];
            row0 ^= tmp;
            col3 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*1+3))+3+36)%36]>>8)];
            row1 ^= tmp;
            col3 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*1+3))+3+36)%36]>>16)];
            row2 ^= tmp;
            col3 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*1+3))+3+36)%36]>>24)];
            col3 ^= tmp;
            m_state[((-3*(3*1+3))+36)%36]= ((row0^col0)&0x000000ff)^((row1^col1)&0x0000ff00)^((row2^col2)&0x00ff0000)^((row3^col3)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[((-3*(3*1+3))+1+36)%36]= ((row0^col1)&0x000000ff)^((row1^col2)&0x0000ff00)^((row2^col3)&0x00ff0000)^((row3^col0)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[((-3*(3*1+3))+2+36)%36]= ((row0^col2)&0x000000ff)^((row1^col3)&0x0000ff00)^((row2^col0)&0x00ff0000)^((row3^col1)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[((-3*(3*1+3))+3+36)%36]= ((row0^col3)&0x000000ff)^((row1^col0)&0x0000ff00)^((row2^col1)&0x00ff0000)^((row3^col2)&0xff000000);

            j++;

            m_state[(-9*2+16+36)%36] ^= m_state[(-9*2+36)%36];
            m_state[(-9*2+36)%36] = ((uint*)a_data)[j];
            m_state[(-9*2+8+36)%36] ^= m_state[(-9*2+36)%36];
            m_state[(-9*2+1+36)%36] ^= m_state[(-9*2+27+36)%36];
            m_state[(-9*2+4+36)%36] ^= m_state[(-9*2+30+36)%36];
            m_state[((-3*(3*2+1))+36)%36] ^= m_state[((-3*(3*2+1))+4+36)%36];
            m_state[((-3*(3*2+1))+1+36)%36] ^= m_state[((-3*(3*2+1))+5+36)%36];
            m_state[((-3*(3*2+1))+2+36)%36] ^= m_state[((-3*(3*2+1))+6+36)%36];
            m_state[((-3*(3*2+1))+18+36)%36] ^= m_state[((-3*(3*2+1))+4+36)%36];
            m_state[((-3*(3*2+1))+19+36)%36] ^= m_state[((-3*(3*2+1))+5+36)%36];
            m_state[((-3*(3*2+1))+20+36)%36] ^= m_state[((-3*(3*2+1))+6+36)%36];
            col0 = col1 = col2 = col3 = 0;
            row0 = row1 = row2 = row3 = 0;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*2+1))+36)%36])];
            col0 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*2+1))+36)%36]>>8)];
            row1 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*2+1))+36)%36]>>16)];
            row2 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*2+1))+36)%36]>>24)];
            row3 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*2+1))+1+36)%36])];
            row0 = tmp;
            col1 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*2+1))+1+36)%36]>>8)];
            col1 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*2+1))+1+36)%36]>>16)];
            row2 ^= tmp;
            col1 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*2+1))+1+36)%36]>>24)];
            row3 ^= tmp;
            col1 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*2+1))+2+36)%36])];
            row0 ^= tmp;
            col2 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*2+1))+2+36)%36]>>8)];
            row1 ^= tmp;
            col2 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*2+1))+2+36)%36]>>16)];
            col2 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*2+1))+2+36)%36]>>24)];
            row3 ^= tmp;
            col2 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*2+1))+3+36)%36])];
            row0 ^= tmp;
            col3 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*2+1))+3+36)%36]>>8)];
            row1 ^= tmp;
            col3 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*2+1))+3+36)%36]>>16)];
            row2 ^= tmp;
            col3 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*2+1))+3+36)%36]>>24)];
            col3 ^= tmp;
            m_state[((-3*(3*2+1))+36)%36]= ((row0^col0)&0x000000ff)^((row1^col1)&0x0000ff00)^((row2^col2)&0x00ff0000)^((row3^col3)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[((-3*(3*2+1))+1+36)%36]= ((row0^col1)&0x000000ff)^((row1^col2)&0x0000ff00)^((row2^col3)&0x00ff0000)^((row3^col0)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[((-3*(3*2+1))+2+36)%36]= ((row0^col2)&0x000000ff)^((row1^col3)&0x0000ff00)^((row2^col0)&0x00ff0000)^((row3^col1)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[((-3*(3*2+1))+3+36)%36]= ((row0^col3)&0x000000ff)^((row1^col0)&0x0000ff00)^((row2^col1)&0x00ff0000)^((row3^col2)&0xff000000);
            m_state[((-3*(3*2+2))+36)%36] ^= m_state[((-3*(3*2+2))+4+36)%36];
            m_state[((-3*(3*2+2))+1+36)%36] ^= m_state[((-3*(3*2+2))+5+36)%36];
            m_state[((-3*(3*2+2))+2+36)%36] ^= m_state[((-3*(3*2+2))+6+36)%36];
            m_state[((-3*(3*2+2))+18+36)%36] ^= m_state[((-3*(3*2+2))+4+36)%36];
            m_state[((-3*(3*2+2))+19+36)%36] ^= m_state[((-3*(3*2+2))+5+36)%36];
            m_state[((-3*(3*2+2))+20+36)%36] ^= m_state[((-3*(3*2+2))+6+36)%36];
            col0 = col1 = col2 = col3 = 0;
            row0 = row1 = row2 = row3 = 0;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*2+2))+36)%36])];
            col0 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*2+2))+36)%36]>>8)];
            row1 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*2+2))+36)%36]>>16)];
            row2 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*2+2))+36)%36]>>24)];
            row3 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*2+2))+1+36)%36])];
            row0 = tmp;
            col1 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*2+2))+1+36)%36]>>8)];
            col1 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*2+2))+1+36)%36]>>16)];
            row2 ^= tmp;
            col1 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*2+2))+1+36)%36]>>24)];
            row3 ^= tmp;
            col1 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*2+2))+2+36)%36])];
            row0 ^= tmp;
            col2 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*2+2))+2+36)%36]>>8)];
            row1 ^= tmp;
            col2 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*2+2))+2+36)%36]>>16)];
            col2 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*2+2))+2+36)%36]>>24)];
            row3 ^= tmp;
            col2 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*2+2))+3+36)%36])];
            row0 ^= tmp;
            col3 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*2+2))+3+36)%36]>>8)];
            row1 ^= tmp;
            col3 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*2+2))+3+36)%36]>>16)];
            row2 ^= tmp;
            col3 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*2+2))+3+36)%36]>>24)];
            col3 ^= tmp;
            m_state[((-3*(3*2+2))+36)%36]= ((row0^col0)&0x000000ff)^((row1^col1)&0x0000ff00)^((row2^col2)&0x00ff0000)^((row3^col3)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[((-3*(3*2+2))+1+36)%36]= ((row0^col1)&0x000000ff)^((row1^col2)&0x0000ff00)^((row2^col3)&0x00ff0000)^((row3^col0)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[((-3*(3*2+2))+2+36)%36]= ((row0^col2)&0x000000ff)^((row1^col3)&0x0000ff00)^((row2^col0)&0x00ff0000)^((row3^col1)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[((-3*(3*2+2))+3+36)%36]= ((row0^col3)&0x000000ff)^((row1^col0)&0x0000ff00)^((row2^col1)&0x00ff0000)^((row3^col2)&0xff000000);
            m_state[((-3*(3*2+3))+36)%36] ^= m_state[((-3*(3*2+3))+4+36)%36];
            m_state[((-3*(3*2+3))+1+36)%36] ^= m_state[((-3*(3*2+3))+5+36)%36];
            m_state[((-3*(3*2+3))+2+36)%36] ^= m_state[((-3*(3*2+3))+6+36)%36];
            m_state[((-3*(3*2+3))+18+36)%36] ^= m_state[((-3*(3*2+3))+4+36)%36];
            m_state[((-3*(3*2+3))+19+36)%36] ^= m_state[((-3*(3*2+3))+5+36)%36];
            m_state[((-3*(3*2+3))+20+36)%36] ^= m_state[((-3*(3*2+3))+6+36)%36];
            col0 = col1 = col2 = col3 = 0;
            row0 = row1 = row2 = row3 = 0;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*2+3))+36)%36])];
            col0 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*2+3))+36)%36]>>8)];
            row1 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*2+3))+36)%36]>>16)];
            row2 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*2+3))+36)%36]>>24)];
            row3 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*2+3))+1+36)%36])];
            row0 = tmp;
            col1 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*2+3))+1+36)%36]>>8)];
            col1 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*2+3))+1+36)%36]>>16)];
            row2 ^= tmp;
            col1 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*2+3))+1+36)%36]>>24)];
            row3 ^= tmp;
            col1 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*2+3))+2+36)%36])];
            row0 ^= tmp;
            col2 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*2+3))+2+36)%36]>>8)];
            row1 ^= tmp;
            col2 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*2+3))+2+36)%36]>>16)];
            col2 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*2+3))+2+36)%36]>>24)];
            row3 ^= tmp;
            col2 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*2+3))+3+36)%36])];
            row0 ^= tmp;
            col3 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*2+3))+3+36)%36]>>8)];
            row1 ^= tmp;
            col3 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*2+3))+3+36)%36]>>16)];
            row2 ^= tmp;
            col3 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*2+3))+3+36)%36]>>24)];
            col3 ^= tmp;
            m_state[((-3*(3*2+3))+36)%36]= ((row0^col0)&0x000000ff)^((row1^col1)&0x0000ff00)^((row2^col2)&0x00ff0000)^((row3^col3)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[((-3*(3*2+3))+1+36)%36]= ((row0^col1)&0x000000ff)^((row1^col2)&0x0000ff00)^((row2^col3)&0x00ff0000)^((row3^col0)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[((-3*(3*2+3))+2+36)%36]= ((row0^col2)&0x000000ff)^((row1^col3)&0x0000ff00)^((row2^col0)&0x00ff0000)^((row3^col1)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[((-3*(3*2+3))+3+36)%36]= ((row0^col3)&0x000000ff)^((row1^col0)&0x0000ff00)^((row2^col1)&0x00ff0000)^((row3^col2)&0xff000000);

            j++;

            m_state[(-9*3+16+36)%36] ^= m_state[(-9*3+36)%36];
            m_state[(-9*3+36)%36] = ((uint*)a_data)[j];
            m_state[(-9*3+8+36)%36] ^= m_state[(-9*3+36)%36];
            m_state[(-9*3+1+36)%36] ^= m_state[(-9*3+27+36)%36];
            m_state[(-9*3+4+36)%36] ^= m_state[(-9*3+30+36)%36];
            m_state[((-3*(3*3+1))+36)%36] ^= m_state[((-3*(3*3+1))+4+36)%36];
            m_state[((-3*(3*3+1))+1+36)%36] ^= m_state[((-3*(3*3+1))+5+36)%36];
            m_state[((-3*(3*3+1))+2+36)%36] ^= m_state[((-3*(3*3+1))+6+36)%36];
            m_state[((-3*(3*3+1))+18+36)%36] ^= m_state[((-3*(3*3+1))+4+36)%36];
            m_state[((-3*(3*3+1))+19+36)%36] ^= m_state[((-3*(3*3+1))+5+36)%36];
            m_state[((-3*(3*3+1))+20+36)%36] ^= m_state[((-3*(3*3+1))+6+36)%36];
            col0 = col1 = col2 = col3 = 0;
            row0 = row1 = row2 = row3 = 0;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*3+1))+36)%36])];
            col0 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*3+1))+36)%36]>>8)];
            row1 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*3+1))+36)%36]>>16)];
            row2 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*3+1))+36)%36]>>24)];
            row3 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*3+1))+1+36)%36])];
            row0 = tmp;
            col1 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*3+1))+1+36)%36]>>8)];
            col1 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*3+1))+1+36)%36]>>16)];
            row2 ^= tmp;
            col1 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*3+1))+1+36)%36]>>24)];
            row3 ^= tmp;
            col1 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*3+1))+2+36)%36])];
            row0 ^= tmp;
            col2 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*3+1))+2+36)%36]>>8)];
            row1 ^= tmp;
            col2 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*3+1))+2+36)%36]>>16)];
            col2 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*3+1))+2+36)%36]>>24)];
            row3 ^= tmp;
            col2 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*3+1))+3+36)%36])];
            row0 ^= tmp;
            col3 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*3+1))+3+36)%36]>>8)];
            row1 ^= tmp;
            col3 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*3+1))+3+36)%36]>>16)];
            row2 ^= tmp;
            col3 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*3+1))+3+36)%36]>>24)];
            col3 ^= tmp;
            m_state[((-3*(3*3+1))+36)%36]= ((row0^col0)&0x000000ff)^((row1^col1)&0x0000ff00)^((row2^col2)&0x00ff0000)^((row3^col3)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[((-3*(3*3+1))+1+36)%36]= ((row0^col1)&0x000000ff)^((row1^col2)&0x0000ff00)^((row2^col3)&0x00ff0000)^((row3^col0)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[((-3*(3*3+1))+2+36)%36]= ((row0^col2)&0x000000ff)^((row1^col3)&0x0000ff00)^((row2^col0)&0x00ff0000)^((row3^col1)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[((-3*(3*3+1))+3+36)%36]= ((row0^col3)&0x000000ff)^((row1^col0)&0x0000ff00)^((row2^col1)&0x00ff0000)^((row3^col2)&0xff000000);
            m_state[((-3*(3*3+2))+36)%36] ^= m_state[((-3*(3*3+2))+4+36)%36];
            m_state[((-3*(3*3+2))+1+36)%36] ^= m_state[((-3*(3*3+2))+5+36)%36];
            m_state[((-3*(3*3+2))+2+36)%36] ^= m_state[((-3*(3*3+2))+6+36)%36];
            m_state[((-3*(3*3+2))+18+36)%36] ^= m_state[((-3*(3*3+2))+4+36)%36];
            m_state[((-3*(3*3+2))+19+36)%36] ^= m_state[((-3*(3*3+2))+5+36)%36];
            m_state[((-3*(3*3+2))+20+36)%36] ^= m_state[((-3*(3*3+2))+6+36)%36];
            col0 = col1 = col2 = col3 = 0;
            row0 = row1 = row2 = row3 = 0;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*3+2))+36)%36])];
            col0 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*3+2))+36)%36]>>8)];
            row1 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*3+2))+36)%36]>>16)];
            row2 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*3+2))+36)%36]>>24)];
            row3 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*3+2))+1+36)%36])];
            row0 = tmp;
            col1 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*3+2))+1+36)%36]>>8)];
            col1 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*3+2))+1+36)%36]>>16)];
            row2 ^= tmp;
            col1 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*3+2))+1+36)%36]>>24)];
            row3 ^= tmp;
            col1 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*3+2))+2+36)%36])];
            row0 ^= tmp;
            col2 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*3+2))+2+36)%36]>>8)];
            row1 ^= tmp;
            col2 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*3+2))+2+36)%36]>>16)];
            col2 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*3+2))+2+36)%36]>>24)];
            row3 ^= tmp;
            col2 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*3+2))+3+36)%36])];
            row0 ^= tmp;
            col3 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*3+2))+3+36)%36]>>8)];
            row1 ^= tmp;
            col3 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*3+2))+3+36)%36]>>16)];
            row2 ^= tmp;
            col3 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*3+2))+3+36)%36]>>24)];
            col3 ^= tmp;
            m_state[((-3*(3*3+2))+36)%36]= ((row0^col0)&0x000000ff)^((row1^col1)&0x0000ff00)^((row2^col2)&0x00ff0000)^((row3^col3)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[((-3*(3*3+2))+1+36)%36]= ((row0^col1)&0x000000ff)^((row1^col2)&0x0000ff00)^((row2^col3)&0x00ff0000)^((row3^col0)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[((-3*(3*3+2))+2+36)%36]= ((row0^col2)&0x000000ff)^((row1^col3)&0x0000ff00)^((row2^col0)&0x00ff0000)^((row3^col1)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[((-3*(3*3+2))+3+36)%36]= ((row0^col3)&0x000000ff)^((row1^col0)&0x0000ff00)^((row2^col1)&0x00ff0000)^((row3^col2)&0xff000000);
            m_state[((-3*(3*3+3))+36)%36] ^= m_state[((-3*(3*3+3))+4+36)%36];
            m_state[((-3*(3*3+3))+1+36)%36] ^= m_state[((-3*(3*3+3))+5+36)%36];
            m_state[((-3*(3*3+3))+2+36)%36] ^= m_state[((-3*(3*3+3))+6+36)%36];
            m_state[((-3*(3*3+3))+18+36)%36] ^= m_state[((-3*(3*3+3))+4+36)%36];
            m_state[((-3*(3*3+3))+19+36)%36] ^= m_state[((-3*(3*3+3))+5+36)%36];
            m_state[((-3*(3*3+3))+20+36)%36] ^= m_state[((-3*(3*3+3))+6+36)%36];
            col0 = col1 = col2 = col3 = 0;
            row0 = row1 = row2 = row3 = 0;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*3+3))+36)%36])];
            col0 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*3+3))+36)%36]>>8)];
            row1 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*3+3))+36)%36]>>16)];
            row2 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*3+3))+36)%36]>>24)];
            row3 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*3+3))+1+36)%36])];
            row0 = tmp;
            col1 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*3+3))+1+36)%36]>>8)];
            col1 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*3+3))+1+36)%36]>>16)];
            row2 ^= tmp;
            col1 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*3+3))+1+36)%36]>>24)];
            row3 ^= tmp;
            col1 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*3+3))+2+36)%36])];
            row0 ^= tmp;
            col2 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*3+3))+2+36)%36]>>8)];
            row1 ^= tmp;
            col2 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*3+3))+2+36)%36]>>16)];
            col2 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*3+3))+2+36)%36]>>24)];
            row3 ^= tmp;
            col2 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*3+3))+3+36)%36])];
            row0 ^= tmp;
            col3 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*3+3))+3+36)%36]>>8)];
            row1 ^= tmp;
            col3 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*3+3))+3+36)%36]>>16)];
            row2 ^= tmp;
            col3 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*3+3))+3+36)%36]>>24)];
            col3 ^= tmp;
            m_state[((-3*(3*3+3))+36)%36]= ((row0^col0)&0x000000ff)^((row1^col1)&0x0000ff00)^((row2^col2)&0x00ff0000)^((row3^col3)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[((-3*(3*3+3))+1+36)%36]= ((row0^col1)&0x000000ff)^((row1^col2)&0x0000ff00)^((row2^col3)&0x00ff0000)^((row3^col0)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[((-3*(3*3+3))+2+36)%36]= ((row0^col2)&0x000000ff)^((row1^col3)&0x0000ff00)^((row2^col0)&0x00ff0000)^((row3^col1)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[((-3*(3*3+3))+3+36)%36]= ((row0^col3)&0x000000ff)^((row1^col0)&0x0000ff00)^((row2^col1)&0x00ff0000)^((row3^col2)&0xff000000);

            j++;
        }

        if (len_mod >=1)
        {
            m_state[(-9*0+16+36)%36] ^= m_state[(-9*0+36)%36];
            m_state[(-9*0+36)%36] = ((uint*)a_data)[j];
            m_state[(-9*0+8+36)%36] ^= m_state[(-9*0+36)%36];
            m_state[(-9*0+1+36)%36] ^= m_state[(-9*0+27+36)%36];
            m_state[(-9*0+4+36)%36] ^= m_state[(-9*0+30+36)%36];
            m_state[((-3*(3*0+1))+36)%36] ^= m_state[((-3*(3*0+1))+4+36)%36];
            m_state[((-3*(3*0+1))+1+36)%36] ^= m_state[((-3*(3*0+1))+5+36)%36];
            m_state[((-3*(3*0+1))+2+36)%36] ^= m_state[((-3*(3*0+1))+6+36)%36];
            m_state[((-3*(3*0+1))+18+36)%36] ^= m_state[((-3*(3*0+1))+4+36)%36];
            m_state[((-3*(3*0+1))+19+36)%36] ^= m_state[((-3*(3*0+1))+5+36)%36];
            m_state[((-3*(3*0+1))+20+36)%36] ^= m_state[((-3*(3*0+1))+6+36)%36];
            col0 = col1 = col2 = col3 = 0;
            row0 = row1 = row2 = row3 = 0;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*0+1))+36)%36])];
            col0 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*0+1))+36)%36]>>8)];
            row1 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*0+1))+36)%36]>>16)];
            row2 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*0+1))+36)%36]>>24)];
            row3 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*0+1))+1+36)%36])];
            row0 = tmp;
            col1 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*0+1))+1+36)%36]>>8)];
            col1 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*0+1))+1+36)%36]>>16)];
            row2 ^= tmp;
            col1 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*0+1))+1+36)%36]>>24)];
            row3 ^= tmp;
            col1 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*0+1))+2+36)%36])];
            row0 ^= tmp;
            col2 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*0+1))+2+36)%36]>>8)];
            row1 ^= tmp;
            col2 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*0+1))+2+36)%36]>>16)];
            col2 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*0+1))+2+36)%36]>>24)];
            row3 ^= tmp;
            col2 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*0+1))+3+36)%36])];
            row0 ^= tmp;
            col3 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*0+1))+3+36)%36]>>8)];
            row1 ^= tmp;
            col3 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*0+1))+3+36)%36]>>16)];
            row2 ^= tmp;
            col3 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*0+1))+3+36)%36]>>24)];
            col3 ^= tmp;
            m_state[((-3*(3*0+1))+36)%36]= ((row0^col0)&0x000000ff)^((row1^col1)&0x0000ff00)^((row2^col2)&0x00ff0000)^((row3^col3)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[((-3*(3*0+1))+1+36)%36]= ((row0^col1)&0x000000ff)^((row1^col2)&0x0000ff00)^((row2^col3)&0x00ff0000)^((row3^col0)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[((-3*(3*0+1))+2+36)%36]= ((row0^col2)&0x000000ff)^((row1^col3)&0x0000ff00)^((row2^col0)&0x00ff0000)^((row3^col1)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[((-3*(3*0+1))+3+36)%36]= ((row0^col3)&0x000000ff)^((row1^col0)&0x0000ff00)^((row2^col1)&0x00ff0000)^((row3^col2)&0xff000000);
            m_state[((-3*(3*0+2))+36)%36] ^= m_state[((-3*(3*0+2))+4+36)%36];
            m_state[((-3*(3*0+2))+1+36)%36] ^= m_state[((-3*(3*0+2))+5+36)%36];
            m_state[((-3*(3*0+2))+2+36)%36] ^= m_state[((-3*(3*0+2))+6+36)%36];
            m_state[((-3*(3*0+2))+18+36)%36] ^= m_state[((-3*(3*0+2))+4+36)%36];
            m_state[((-3*(3*0+2))+19+36)%36] ^= m_state[((-3*(3*0+2))+5+36)%36];
            m_state[((-3*(3*0+2))+20+36)%36] ^= m_state[((-3*(3*0+2))+6+36)%36];
            col0 = col1 = col2 = col3 = 0;
            row0 = row1 = row2 = row3 = 0;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*0+2))+36)%36])];
            col0 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*0+2))+36)%36]>>8)];
            row1 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*0+2))+36)%36]>>16)];
            row2 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*0+2))+36)%36]>>24)];
            row3 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*0+2))+1+36)%36])];
            row0 = tmp;
            col1 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*0+2))+1+36)%36]>>8)];
            col1 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*0+2))+1+36)%36]>>16)];
            row2 ^= tmp;
            col1 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*0+2))+1+36)%36]>>24)];
            row3 ^= tmp;
            col1 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*0+2))+2+36)%36])];
            row0 ^= tmp;
            col2 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*0+2))+2+36)%36]>>8)];
            row1 ^= tmp;
            col2 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*0+2))+2+36)%36]>>16)];
            col2 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*0+2))+2+36)%36]>>24)];
            row3 ^= tmp;
            col2 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*0+2))+3+36)%36])];
            row0 ^= tmp;
            col3 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*0+2))+3+36)%36]>>8)];
            row1 ^= tmp;
            col3 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*0+2))+3+36)%36]>>16)];
            row2 ^= tmp;
            col3 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*0+2))+3+36)%36]>>24)];
            col3 ^= tmp;
            m_state[((-3*(3*0+2))+36)%36]= ((row0^col0)&0x000000ff)^((row1^col1)&0x0000ff00)^((row2^col2)&0x00ff0000)^((row3^col3)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[((-3*(3*0+2))+1+36)%36]= ((row0^col1)&0x000000ff)^((row1^col2)&0x0000ff00)^((row2^col3)&0x00ff0000)^((row3^col0)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[((-3*(3*0+2))+2+36)%36]= ((row0^col2)&0x000000ff)^((row1^col3)&0x0000ff00)^((row2^col0)&0x00ff0000)^((row3^col1)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[((-3*(3*0+2))+3+36)%36]= ((row0^col3)&0x000000ff)^((row1^col0)&0x0000ff00)^((row2^col1)&0x00ff0000)^((row3^col2)&0xff000000);
            m_state[((-3*(3*0+3))+36)%36] ^= m_state[((-3*(3*0+3))+4+36)%36];
            m_state[((-3*(3*0+3))+1+36)%36] ^= m_state[((-3*(3*0+3))+5+36)%36];
            m_state[((-3*(3*0+3))+2+36)%36] ^= m_state[((-3*(3*0+3))+6+36)%36];
            m_state[((-3*(3*0+3))+18+36)%36] ^= m_state[((-3*(3*0+3))+4+36)%36];
            m_state[((-3*(3*0+3))+19+36)%36] ^= m_state[((-3*(3*0+3))+5+36)%36];
            m_state[((-3*(3*0+3))+20+36)%36] ^= m_state[((-3*(3*0+3))+6+36)%36];
            col0 = col1 = col2 = col3 = 0;
            row0 = row1 = row2 = row3 = 0;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*0+3))+36)%36])];
            col0 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*0+3))+36)%36]>>8)];
            row1 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*0+3))+36)%36]>>16)];
            row2 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*0+3))+36)%36]>>24)];
            row3 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*0+3))+1+36)%36])];
            row0 = tmp;
            col1 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*0+3))+1+36)%36]>>8)];
            col1 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*0+3))+1+36)%36]>>16)];
            row2 ^= tmp;
            col1 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*0+3))+1+36)%36]>>24)];
            row3 ^= tmp;
            col1 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*0+3))+2+36)%36])];
            row0 ^= tmp;
            col2 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*0+3))+2+36)%36]>>8)];
            row1 ^= tmp;
            col2 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*0+3))+2+36)%36]>>16)];
            col2 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*0+3))+2+36)%36]>>24)];
            row3 ^= tmp;
            col2 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*0+3))+3+36)%36])];
            row0 ^= tmp;
            col3 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*0+3))+3+36)%36]>>8)];
            row1 ^= tmp;
            col3 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*0+3))+3+36)%36]>>16)];
            row2 ^= tmp;
            col3 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*0+3))+3+36)%36]>>24)];
            col3 ^= tmp;
            m_state[((-3*(3*0+3))+36)%36]= ((row0^col0)&0x000000ff)^((row1^col1)&0x0000ff00)^((row2^col2)&0x00ff0000)^((row3^col3)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[((-3*(3*0+3))+1+36)%36]= ((row0^col1)&0x000000ff)^((row1^col2)&0x0000ff00)^((row2^col3)&0x00ff0000)^((row3^col0)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[((-3*(3*0+3))+2+36)%36]= ((row0^col2)&0x000000ff)^((row1^col3)&0x0000ff00)^((row2^col0)&0x00ff0000)^((row3^col1)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[((-3*(3*0+3))+3+36)%36]= ((row0^col3)&0x000000ff)^((row1^col0)&0x0000ff00)^((row2^col1)&0x00ff0000)^((row3^col2)&0xff000000);
            j++;

            if (len_mod >=2)
            {
                m_state[(-9*1+16+36)%36] ^= m_state[(-9*1+36)%36];
                m_state[(-9*1+36)%36] = ((uint*)a_data)[j];
                m_state[(-9*1+8+36)%36] ^= m_state[(-9*1+36)%36];
                m_state[(-9*1+1+36)%36] ^= m_state[(-9*1+27+36)%36];
                m_state[(-9*1+4+36)%36] ^= m_state[(-9*1+30+36)%36];
                m_state[((-3*(3*1+1))+36)%36] ^= m_state[((-3*(3*1+1))+4+36)%36];
                m_state[((-3*(3*1+1))+1+36)%36] ^= m_state[((-3*(3*1+1))+5+36)%36];
                m_state[((-3*(3*1+1))+2+36)%36] ^= m_state[((-3*(3*1+1))+6+36)%36];
                m_state[((-3*(3*1+1))+18+36)%36] ^= m_state[((-3*(3*1+1))+4+36)%36];
                m_state[((-3*(3*1+1))+19+36)%36] ^= m_state[((-3*(3*1+1))+5+36)%36];
                m_state[((-3*(3*1+1))+20+36)%36] ^= m_state[((-3*(3*1+1))+6+36)%36];
                col0 = col1 = col2 = col3 = 0;
                row0 = row1 = row2 = row3 = 0;
                tmp = aes_style_table0[(byte)(m_state[((-3*(3*1+1))+36)%36])];
                col0 = tmp;
                tmp = aes_style_table1[(byte)(m_state[((-3*(3*1+1))+36)%36]>>8)];
                row1 = tmp;
                col0 ^= tmp;
                tmp = aes_style_table2[(byte)(m_state[((-3*(3*1+1))+36)%36]>>16)];
                row2 = tmp;
                col0 ^= tmp;
                tmp = aes_style_table3[(byte)(m_state[((-3*(3*1+1))+36)%36]>>24)];
                row3 = tmp;
                col0 ^= tmp;
                tmp = aes_style_table0[(byte)(m_state[((-3*(3*1+1))+1+36)%36])];
                row0 = tmp;
                col1 = tmp;
                tmp = aes_style_table1[(byte)(m_state[((-3*(3*1+1))+1+36)%36]>>8)];
                col1 ^= tmp;
                tmp = aes_style_table2[(byte)(m_state[((-3*(3*1+1))+1+36)%36]>>16)];
                row2 ^= tmp;
                col1 ^= tmp;
                tmp = aes_style_table3[(byte)(m_state[((-3*(3*1+1))+1+36)%36]>>24)];
                row3 ^= tmp;
                col1 ^= tmp;
                tmp = aes_style_table0[(byte)(m_state[((-3*(3*1+1))+2+36)%36])];
                row0 ^= tmp;
                col2 = tmp;
                tmp = aes_style_table1[(byte)(m_state[((-3*(3*1+1))+2+36)%36]>>8)];
                row1 ^= tmp;
                col2 ^= tmp;
                tmp = aes_style_table2[(byte)(m_state[((-3*(3*1+1))+2+36)%36]>>16)];
                col2 ^= tmp;
                tmp = aes_style_table3[(byte)(m_state[((-3*(3*1+1))+2+36)%36]>>24)];
                row3 ^= tmp;
                col2 ^= tmp;
                tmp = aes_style_table0[(byte)(m_state[((-3*(3*1+1))+3+36)%36])];
                row0 ^= tmp;
                col3 = tmp;
                tmp = aes_style_table1[(byte)(m_state[((-3*(3*1+1))+3+36)%36]>>8)];
                row1 ^= tmp;
                col3 ^= tmp;
                tmp = aes_style_table2[(byte)(m_state[((-3*(3*1+1))+3+36)%36]>>16)];
                row2 ^= tmp;
                col3 ^= tmp;
                tmp = aes_style_table3[(byte)(m_state[((-3*(3*1+1))+3+36)%36]>>24)];
                col3 ^= tmp;
                m_state[((-3*(3*1+1))+36)%36]= ((row0^col0)&0x000000ff)^((row1^col1)&0x0000ff00)^((row2^col2)&0x00ff0000)^((row3^col3)&0xff000000);
                row0 = ((row0<<24)|(row0>>8));
                row1 = ((row1<<24)|(row1>>8));
                row2 = ((row2<<24)|(row2>>8));
                row3 = ((row3<<24)|(row3>>8));
                m_state[((-3*(3*1+1))+1+36)%36]= ((row0^col1)&0x000000ff)^((row1^col2)&0x0000ff00)^((row2^col3)&0x00ff0000)^((row3^col0)&0xff000000);
                row0 = ((row0<<24)|(row0>>8));
                row1 = ((row1<<24)|(row1>>8));
                row2 = ((row2<<24)|(row2>>8));
                row3 = ((row3<<24)|(row3>>8));
                m_state[((-3*(3*1+1))+2+36)%36]= ((row0^col2)&0x000000ff)^((row1^col3)&0x0000ff00)^((row2^col0)&0x00ff0000)^((row3^col1)&0xff000000);
                row0 = ((row0<<24)|(row0>>8));
                row1 = ((row1<<24)|(row1>>8));
                row2 = ((row2<<24)|(row2>>8));
                row3 = ((row3<<24)|(row3>>8));
                m_state[((-3*(3*1+1))+3+36)%36]= ((row0^col3)&0x000000ff)^((row1^col0)&0x0000ff00)^((row2^col1)&0x00ff0000)^((row3^col2)&0xff000000);
                m_state[((-3*(3*1+2))+36)%36] ^= m_state[((-3*(3*1+2))+4+36)%36];
                m_state[((-3*(3*1+2))+1+36)%36] ^= m_state[((-3*(3*1+2))+5+36)%36];
                m_state[((-3*(3*1+2))+2+36)%36] ^= m_state[((-3*(3*1+2))+6+36)%36];
                m_state[((-3*(3*1+2))+18+36)%36] ^= m_state[((-3*(3*1+2))+4+36)%36];
                m_state[((-3*(3*1+2))+19+36)%36] ^= m_state[((-3*(3*1+2))+5+36)%36];
                m_state[((-3*(3*1+2))+20+36)%36] ^= m_state[((-3*(3*1+2))+6+36)%36];
                col0 = col1 = col2 = col3 = 0;
                row0 = row1 = row2 = row3 = 0;
                tmp = aes_style_table0[(byte)(m_state[((-3*(3*1+2))+36)%36])];
                col0 = tmp;
                tmp = aes_style_table1[(byte)(m_state[((-3*(3*1+2))+36)%36]>>8)];
                row1 = tmp;
                col0 ^= tmp;
                tmp = aes_style_table2[(byte)(m_state[((-3*(3*1+2))+36)%36]>>16)];
                row2 = tmp;
                col0 ^= tmp;
                tmp = aes_style_table3[(byte)(m_state[((-3*(3*1+2))+36)%36]>>24)];
                row3 = tmp;
                col0 ^= tmp;
                tmp = aes_style_table0[(byte)(m_state[((-3*(3*1+2))+1+36)%36])];
                row0 = tmp;
                col1 = tmp;
                tmp = aes_style_table1[(byte)(m_state[((-3*(3*1+2))+1+36)%36]>>8)];
                col1 ^= tmp;
                tmp = aes_style_table2[(byte)(m_state[((-3*(3*1+2))+1+36)%36]>>16)];
                row2 ^= tmp;
                col1 ^= tmp;
                tmp = aes_style_table3[(byte)(m_state[((-3*(3*1+2))+1+36)%36]>>24)];
                row3 ^= tmp;
                col1 ^= tmp;
                tmp = aes_style_table0[(byte)(m_state[((-3*(3*1+2))+2+36)%36])];
                row0 ^= tmp;
                col2 = tmp;
                tmp = aes_style_table1[(byte)(m_state[((-3*(3*1+2))+2+36)%36]>>8)];
                row1 ^= tmp;
                col2 ^= tmp;
                tmp = aes_style_table2[(byte)(m_state[((-3*(3*1+2))+2+36)%36]>>16)];
                col2 ^= tmp;
                tmp = aes_style_table3[(byte)(m_state[((-3*(3*1+2))+2+36)%36]>>24)];
                row3 ^= tmp;
                col2 ^= tmp;
                tmp = aes_style_table0[(byte)(m_state[((-3*(3*1+2))+3+36)%36])];
                row0 ^= tmp;
                col3 = tmp;
                tmp = aes_style_table1[(byte)(m_state[((-3*(3*1+2))+3+36)%36]>>8)];
                row1 ^= tmp;
                col3 ^= tmp;
                tmp = aes_style_table2[(byte)(m_state[((-3*(3*1+2))+3+36)%36]>>16)];
                row2 ^= tmp;
                col3 ^= tmp;
                tmp = aes_style_table3[(byte)(m_state[((-3*(3*1+2))+3+36)%36]>>24)];
                col3 ^= tmp;
                m_state[((-3*(3*1+2))+36)%36]= ((row0^col0)&0x000000ff)^((row1^col1)&0x0000ff00)^((row2^col2)&0x00ff0000)^((row3^col3)&0xff000000);
                row0 = ((row0<<24)|(row0>>8));
                row1 = ((row1<<24)|(row1>>8));
                row2 = ((row2<<24)|(row2>>8));
                row3 = ((row3<<24)|(row3>>8));
                m_state[((-3*(3*1+2))+1+36)%36]= ((row0^col1)&0x000000ff)^((row1^col2)&0x0000ff00)^((row2^col3)&0x00ff0000)^((row3^col0)&0xff000000);
                row0 = ((row0<<24)|(row0>>8));
                row1 = ((row1<<24)|(row1>>8));
                row2 = ((row2<<24)|(row2>>8));
                row3 = ((row3<<24)|(row3>>8));
                m_state[((-3*(3*1+2))+2+36)%36]= ((row0^col2)&0x000000ff)^((row1^col3)&0x0000ff00)^((row2^col0)&0x00ff0000)^((row3^col1)&0xff000000);
                row0 = ((row0<<24)|(row0>>8));
                row1 = ((row1<<24)|(row1>>8));
                row2 = ((row2<<24)|(row2>>8));
                row3 = ((row3<<24)|(row3>>8));
                m_state[((-3*(3*1+2))+3+36)%36]= ((row0^col3)&0x000000ff)^((row1^col0)&0x0000ff00)^((row2^col1)&0x00ff0000)^((row3^col2)&0xff000000);
                m_state[((-3*(3*1+3))+36)%36] ^= m_state[((-3*(3*1+3))+4+36)%36];
                m_state[((-3*(3*1+3))+1+36)%36] ^= m_state[((-3*(3*1+3))+5+36)%36];
                m_state[((-3*(3*1+3))+2+36)%36] ^= m_state[((-3*(3*1+3))+6+36)%36];
                m_state[((-3*(3*1+3))+18+36)%36] ^= m_state[((-3*(3*1+3))+4+36)%36];
                m_state[((-3*(3*1+3))+19+36)%36] ^= m_state[((-3*(3*1+3))+5+36)%36];
                m_state[((-3*(3*1+3))+20+36)%36] ^= m_state[((-3*(3*1+3))+6+36)%36];
                col0 = col1 = col2 = col3 = 0;
                row0 = row1 = row2 = row3 = 0;
                tmp = aes_style_table0[(byte)(m_state[((-3*(3*1+3))+36)%36])];
                col0 = tmp;
                tmp = aes_style_table1[(byte)(m_state[((-3*(3*1+3))+36)%36]>>8)];
                row1 = tmp;
                col0 ^= tmp;
                tmp = aes_style_table2[(byte)(m_state[((-3*(3*1+3))+36)%36]>>16)];
                row2 = tmp;
                col0 ^= tmp;
                tmp = aes_style_table3[(byte)(m_state[((-3*(3*1+3))+36)%36]>>24)];
                row3 = tmp;
                col0 ^= tmp;
                tmp = aes_style_table0[(byte)(m_state[((-3*(3*1+3))+1+36)%36])];
                row0 = tmp;
                col1 = tmp;
                tmp = aes_style_table1[(byte)(m_state[((-3*(3*1+3))+1+36)%36]>>8)];
                col1 ^= tmp;
                tmp = aes_style_table2[(byte)(m_state[((-3*(3*1+3))+1+36)%36]>>16)];
                row2 ^= tmp;
                col1 ^= tmp;
                tmp = aes_style_table3[(byte)(m_state[((-3*(3*1+3))+1+36)%36]>>24)];
                row3 ^= tmp;
                col1 ^= tmp;
                tmp = aes_style_table0[(byte)(m_state[((-3*(3*1+3))+2+36)%36])];
                row0 ^= tmp;
                col2 = tmp;
                tmp = aes_style_table1[(byte)(m_state[((-3*(3*1+3))+2+36)%36]>>8)];
                row1 ^= tmp;
                col2 ^= tmp;
                tmp = aes_style_table2[(byte)(m_state[((-3*(3*1+3))+2+36)%36]>>16)];
                col2 ^= tmp;
                tmp = aes_style_table3[(byte)(m_state[((-3*(3*1+3))+2+36)%36]>>24)];
                row3 ^= tmp;
                col2 ^= tmp;
                tmp = aes_style_table0[(byte)(m_state[((-3*(3*1+3))+3+36)%36])];
                row0 ^= tmp;
                col3 = tmp;
                tmp = aes_style_table1[(byte)(m_state[((-3*(3*1+3))+3+36)%36]>>8)];
                row1 ^= tmp;
                col3 ^= tmp;
                tmp = aes_style_table2[(byte)(m_state[((-3*(3*1+3))+3+36)%36]>>16)];
                row2 ^= tmp;
                col3 ^= tmp;
                tmp = aes_style_table3[(byte)(m_state[((-3*(3*1+3))+3+36)%36]>>24)];
                col3 ^= tmp;
                m_state[((-3*(3*1+3))+36)%36]= ((row0^col0)&0x000000ff)^((row1^col1)&0x0000ff00)^((row2^col2)&0x00ff0000)^((row3^col3)&0xff000000);
                row0 = ((row0<<24)|(row0>>8));
                row1 = ((row1<<24)|(row1>>8));
                row2 = ((row2<<24)|(row2>>8));
                row3 = ((row3<<24)|(row3>>8));
                m_state[((-3*(3*1+3))+1+36)%36]= ((row0^col1)&0x000000ff)^((row1^col2)&0x0000ff00)^((row2^col3)&0x00ff0000)^((row3^col0)&0xff000000);
                row0 = ((row0<<24)|(row0>>8));
                row1 = ((row1<<24)|(row1>>8));
                row2 = ((row2<<24)|(row2>>8));
                row3 = ((row3<<24)|(row3>>8));
                m_state[((-3*(3*1+3))+2+36)%36]= ((row0^col2)&0x000000ff)^((row1^col3)&0x0000ff00)^((row2^col0)&0x00ff0000)^((row3^col1)&0xff000000);
                row0 = ((row0<<24)|(row0>>8));
                row1 = ((row1<<24)|(row1>>8));
                row2 = ((row2<<24)|(row2>>8));
                row3 = ((row3<<24)|(row3>>8));
                m_state[((-3*(3*1+3))+3+36)%36]= ((row0^col3)&0x000000ff)^((row1^col0)&0x0000ff00)^((row2^col1)&0x00ff0000)^((row3^col2)&0xff000000);

                j++;

                if (len_mod >=3)
                {
                    m_state[(-9*2+16+36)%36] ^= m_state[(-9*2+36)%36];
                    m_state[(-9*2+36)%36] = ((uint*)a_data)[j];
                    m_state[(-9*2+8+36)%36] ^= m_state[(-9*2+36)%36];
                    m_state[(-9*2+1+36)%36] ^= m_state[(-9*2+27+36)%36];
                    m_state[(-9*2+4+36)%36] ^= m_state[(-9*2+30+36)%36];
                    m_state[((-3*(3*2+1))+36)%36] ^= m_state[((-3*(3*2+1))+4+36)%36];
                    m_state[((-3*(3*2+1))+1+36)%36] ^= m_state[((-3*(3*2+1))+5+36)%36];
                    m_state[((-3*(3*2+1))+2+36)%36] ^= m_state[((-3*(3*2+1))+6+36)%36];
                    m_state[((-3*(3*2+1))+18+36)%36] ^= m_state[((-3*(3*2+1))+4+36)%36];
                    m_state[((-3*(3*2+1))+19+36)%36] ^= m_state[((-3*(3*2+1))+5+36)%36];
                    m_state[((-3*(3*2+1))+20+36)%36] ^= m_state[((-3*(3*2+1))+6+36)%36];
                    col0 = col1 = col2 = col3 = 0;
                    row0 = row1 = row2 = row3 = 0;
                    tmp = aes_style_table0[(byte)(m_state[((-3*(3*2+1))+36)%36])];
                    col0 = tmp;
                    tmp = aes_style_table1[(byte)(m_state[((-3*(3*2+1))+36)%36]>>8)];
                    row1 = tmp;
                    col0 ^= tmp;
                    tmp = aes_style_table2[(byte)(m_state[((-3*(3*2+1))+36)%36]>>16)];
                    row2 = tmp;
                    col0 ^= tmp;
                    tmp = aes_style_table3[(byte)(m_state[((-3*(3*2+1))+36)%36]>>24)];
                    row3 = tmp;
                    col0 ^= tmp;
                    tmp = aes_style_table0[(byte)(m_state[((-3*(3*2+1))+1+36)%36])];
                    row0 = tmp;
                    col1 = tmp;
                    tmp = aes_style_table1[(byte)(m_state[((-3*(3*2+1))+1+36)%36]>>8)];
                    col1 ^= tmp;
                    tmp = aes_style_table2[(byte)(m_state[((-3*(3*2+1))+1+36)%36]>>16)];
                    row2 ^= tmp;
                    col1 ^= tmp;
                    tmp = aes_style_table3[(byte)(m_state[((-3*(3*2+1))+1+36)%36]>>24)];
                    row3 ^= tmp;
                    col1 ^= tmp;
                    tmp = aes_style_table0[(byte)(m_state[((-3*(3*2+1))+2+36)%36])];
                    row0 ^= tmp;
                    col2 = tmp;
                    tmp = aes_style_table1[(byte)(m_state[((-3*(3*2+1))+2+36)%36]>>8)];
                    row1 ^= tmp;
                    col2 ^= tmp;
                    tmp = aes_style_table2[(byte)(m_state[((-3*(3*2+1))+2+36)%36]>>16)];
                    col2 ^= tmp;
                    tmp = aes_style_table3[(byte)(m_state[((-3*(3*2+1))+2+36)%36]>>24)];
                    row3 ^= tmp;
                    col2 ^= tmp;
                    tmp = aes_style_table0[(byte)(m_state[((-3*(3*2+1))+3+36)%36])];
                    row0 ^= tmp;
                    col3 = tmp;
                    tmp = aes_style_table1[(byte)(m_state[((-3*(3*2+1))+3+36)%36]>>8)];
                    row1 ^= tmp;
                    col3 ^= tmp;
                    tmp = aes_style_table2[(byte)(m_state[((-3*(3*2+1))+3+36)%36]>>16)];
                    row2 ^= tmp;
                    col3 ^= tmp;
                    tmp = aes_style_table3[(byte)(m_state[((-3*(3*2+1))+3+36)%36]>>24)];
                    col3 ^= tmp;
                    m_state[((-3*(3*2+1))+36)%36]= ((row0^col0)&0x000000ff)^((row1^col1)&0x0000ff00)^((row2^col2)&0x00ff0000)^((row3^col3)&0xff000000);
                    row0 = ((row0<<24)|(row0>>8));
                    row1 = ((row1<<24)|(row1>>8));
                    row2 = ((row2<<24)|(row2>>8));
                    row3 = ((row3<<24)|(row3>>8));
                    m_state[((-3*(3*2+1))+1+36)%36]= ((row0^col1)&0x000000ff)^((row1^col2)&0x0000ff00)^((row2^col3)&0x00ff0000)^((row3^col0)&0xff000000);
                    row0 = ((row0<<24)|(row0>>8));
                    row1 = ((row1<<24)|(row1>>8));
                    row2 = ((row2<<24)|(row2>>8));
                    row3 = ((row3<<24)|(row3>>8));
                    m_state[((-3*(3*2+1))+2+36)%36]= ((row0^col2)&0x000000ff)^((row1^col3)&0x0000ff00)^((row2^col0)&0x00ff0000)^((row3^col1)&0xff000000);
                    row0 = ((row0<<24)|(row0>>8));
                    row1 = ((row1<<24)|(row1>>8));
                    row2 = ((row2<<24)|(row2>>8));
                    row3 = ((row3<<24)|(row3>>8));
                    m_state[((-3*(3*2+1))+3+36)%36]= ((row0^col3)&0x000000ff)^((row1^col0)&0x0000ff00)^((row2^col1)&0x00ff0000)^((row3^col2)&0xff000000);
                    m_state[((-3*(3*2+2))+36)%36] ^= m_state[((-3*(3*2+2))+4+36)%36];
                    m_state[((-3*(3*2+2))+1+36)%36] ^= m_state[((-3*(3*2+2))+5+36)%36];
                    m_state[((-3*(3*2+2))+2+36)%36] ^= m_state[((-3*(3*2+2))+6+36)%36];
                    m_state[((-3*(3*2+2))+18+36)%36] ^= m_state[((-3*(3*2+2))+4+36)%36];
                    m_state[((-3*(3*2+2))+19+36)%36] ^= m_state[((-3*(3*2+2))+5+36)%36];
                    m_state[((-3*(3*2+2))+20+36)%36] ^= m_state[((-3*(3*2+2))+6+36)%36];
                    col0 = col1 = col2 = col3 = 0;
                    row0 = row1 = row2 = row3 = 0;
                    tmp = aes_style_table0[(byte)(m_state[((-3*(3*2+2))+36)%36])];
                    col0 = tmp;
                    tmp = aes_style_table1[(byte)(m_state[((-3*(3*2+2))+36)%36]>>8)];
                    row1 = tmp;
                    col0 ^= tmp;
                    tmp = aes_style_table2[(byte)(m_state[((-3*(3*2+2))+36)%36]>>16)];
                    row2 = tmp;
                    col0 ^= tmp;
                    tmp = aes_style_table3[(byte)(m_state[((-3*(3*2+2))+36)%36]>>24)];
                    row3 = tmp;
                    col0 ^= tmp;
                    tmp = aes_style_table0[(byte)(m_state[((-3*(3*2+2))+1+36)%36])];
                    row0 = tmp;
                    col1 = tmp;
                    tmp = aes_style_table1[(byte)(m_state[((-3*(3*2+2))+1+36)%36]>>8)];
                    col1 ^= tmp;
                    tmp = aes_style_table2[(byte)(m_state[((-3*(3*2+2))+1+36)%36]>>16)];
                    row2 ^= tmp;
                    col1 ^= tmp;
                    tmp = aes_style_table3[(byte)(m_state[((-3*(3*2+2))+1+36)%36]>>24)];
                    row3 ^= tmp;
                    col1 ^= tmp;
                    tmp = aes_style_table0[(byte)(m_state[((-3*(3*2+2))+2+36)%36])];
                    row0 ^= tmp;
                    col2 = tmp;
                    tmp = aes_style_table1[(byte)(m_state[((-3*(3*2+2))+2+36)%36]>>8)];
                    row1 ^= tmp;
                    col2 ^= tmp;
                    tmp = aes_style_table2[(byte)(m_state[((-3*(3*2+2))+2+36)%36]>>16)];
                    col2 ^= tmp;
                    tmp = aes_style_table3[(byte)(m_state[((-3*(3*2+2))+2+36)%36]>>24)];
                    row3 ^= tmp;
                    col2 ^= tmp;
                    tmp = aes_style_table0[(byte)(m_state[((-3*(3*2+2))+3+36)%36])];
                    row0 ^= tmp;
                    col3 = tmp;
                    tmp = aes_style_table1[(byte)(m_state[((-3*(3*2+2))+3+36)%36]>>8)];
                    row1 ^= tmp;
                    col3 ^= tmp;
                    tmp = aes_style_table2[(byte)(m_state[((-3*(3*2+2))+3+36)%36]>>16)];
                    row2 ^= tmp;
                    col3 ^= tmp;
                    tmp = aes_style_table3[(byte)(m_state[((-3*(3*2+2))+3+36)%36]>>24)];
                    col3 ^= tmp;
                    m_state[((-3*(3*2+2))+36)%36]= ((row0^col0)&0x000000ff)^((row1^col1)&0x0000ff00)^((row2^col2)&0x00ff0000)^((row3^col3)&0xff000000);
                    row0 = ((row0<<24)|(row0>>8));
                    row1 = ((row1<<24)|(row1>>8));
                    row2 = ((row2<<24)|(row2>>8));
                    row3 = ((row3<<24)|(row3>>8));
                    m_state[((-3*(3*2+2))+1+36)%36]= ((row0^col1)&0x000000ff)^((row1^col2)&0x0000ff00)^((row2^col3)&0x00ff0000)^((row3^col0)&0xff000000);
                    row0 = ((row0<<24)|(row0>>8));
                    row1 = ((row1<<24)|(row1>>8));
                    row2 = ((row2<<24)|(row2>>8));
                    row3 = ((row3<<24)|(row3>>8));
                    m_state[((-3*(3*2+2))+2+36)%36]= ((row0^col2)&0x000000ff)^((row1^col3)&0x0000ff00)^((row2^col0)&0x00ff0000)^((row3^col1)&0xff000000);
                    row0 = ((row0<<24)|(row0>>8));
                    row1 = ((row1<<24)|(row1>>8));
                    row2 = ((row2<<24)|(row2>>8));
                    row3 = ((row3<<24)|(row3>>8));
                    m_state[((-3*(3*2+2))+3+36)%36]= ((row0^col3)&0x000000ff)^((row1^col0)&0x0000ff00)^((row2^col1)&0x00ff0000)^((row3^col2)&0xff000000);
                    m_state[((-3*(3*2+3))+36)%36] ^= m_state[((-3*(3*2+3))+4+36)%36];
                    m_state[((-3*(3*2+3))+1+36)%36] ^= m_state[((-3*(3*2+3))+5+36)%36];
                    m_state[((-3*(3*2+3))+2+36)%36] ^= m_state[((-3*(3*2+3))+6+36)%36];
                    m_state[((-3*(3*2+3))+18+36)%36] ^= m_state[((-3*(3*2+3))+4+36)%36];
                    m_state[((-3*(3*2+3))+19+36)%36] ^= m_state[((-3*(3*2+3))+5+36)%36];
                    m_state[((-3*(3*2+3))+20+36)%36] ^= m_state[((-3*(3*2+3))+6+36)%36];
                    col0 = col1 = col2 = col3 = 0;
                    row0 = row1 = row2 = row3 = 0;
                    tmp = aes_style_table0[(byte)(m_state[((-3*(3*2+3))+36)%36])];
                    col0 = tmp;
                    tmp = aes_style_table1[(byte)(m_state[((-3*(3*2+3))+36)%36]>>8)];
                    row1 = tmp;
                    col0 ^= tmp;
                    tmp = aes_style_table2[(byte)(m_state[((-3*(3*2+3))+36)%36]>>16)];
                    row2 = tmp;
                    col0 ^= tmp;
                    tmp = aes_style_table3[(byte)(m_state[((-3*(3*2+3))+36)%36]>>24)];
                    row3 = tmp;
                    col0 ^= tmp;
                    tmp = aes_style_table0[(byte)(m_state[((-3*(3*2+3))+1+36)%36])];
                    row0 = tmp;
                    col1 = tmp;
                    tmp = aes_style_table1[(byte)(m_state[((-3*(3*2+3))+1+36)%36]>>8)];
                    col1 ^= tmp;
                    tmp = aes_style_table2[(byte)(m_state[((-3*(3*2+3))+1+36)%36]>>16)];
                    row2 ^= tmp;
                    col1 ^= tmp;
                    tmp = aes_style_table3[(byte)(m_state[((-3*(3*2+3))+1+36)%36]>>24)];
                    row3 ^= tmp;
                    col1 ^= tmp;
                    tmp = aes_style_table0[(byte)(m_state[((-3*(3*2+3))+2+36)%36])];
                    row0 ^= tmp;
                    col2 = tmp;
                    tmp = aes_style_table1[(byte)(m_state[((-3*(3*2+3))+2+36)%36]>>8)];
                    row1 ^= tmp;
                    col2 ^= tmp;
                    tmp = aes_style_table2[(byte)(m_state[((-3*(3*2+3))+2+36)%36]>>16)];
                    col2 ^= tmp;
                    tmp = aes_style_table3[(byte)(m_state[((-3*(3*2+3))+2+36)%36]>>24)];
                    row3 ^= tmp;
                    col2 ^= tmp;
                    tmp = aes_style_table0[(byte)(m_state[((-3*(3*2+3))+3+36)%36])];
                    row0 ^= tmp;
                    col3 = tmp;
                    tmp = aes_style_table1[(byte)(m_state[((-3*(3*2+3))+3+36)%36]>>8)];
                    row1 ^= tmp;
                    col3 ^= tmp;
                    tmp = aes_style_table2[(byte)(m_state[((-3*(3*2+3))+3+36)%36]>>16)];
                    row2 ^= tmp;
                    col3 ^= tmp;
                    tmp = aes_style_table3[(byte)(m_state[((-3*(3*2+3))+3+36)%36]>>24)];
                    col3 ^= tmp;
                    m_state[((-3*(3*2+3))+36)%36]= ((row0^col0)&0x000000ff)^((row1^col1)&0x0000ff00)^((row2^col2)&0x00ff0000)^((row3^col3)&0xff000000);
                    row0 = ((row0<<24)|(row0>>8));
                    row1 = ((row1<<24)|(row1>>8));
                    row2 = ((row2<<24)|(row2>>8));
                    row3 = ((row3<<24)|(row3>>8));
                    m_state[((-3*(3*2+3))+1+36)%36]= ((row0^col1)&0x000000ff)^((row1^col2)&0x0000ff00)^((row2^col3)&0x00ff0000)^((row3^col0)&0xff000000);
                    row0 = ((row0<<24)|(row0>>8));
                    row1 = ((row1<<24)|(row1>>8));
                    row2 = ((row2<<24)|(row2>>8));
                    row3 = ((row3<<24)|(row3>>8));
                    m_state[((-3*(3*2+3))+2+36)%36]= ((row0^col2)&0x000000ff)^((row1^col3)&0x0000ff00)^((row2^col0)&0x00ff0000)^((row3^col1)&0xff000000);
                    row0 = ((row0<<24)|(row0>>8));
                    row1 = ((row1<<24)|(row1>>8));
                    row2 = ((row2<<24)|(row2>>8));
                    row3 = ((row3<<24)|(row3>>8));
                    m_state[((-3*(3*2+3))+3+36)%36]= ((row0^col3)&0x000000ff)^((row1^col0)&0x0000ff00)^((row2^col1)&0x00ff0000)^((row3^col2)&0xff000000);

                    j++;
                }
            }
        }

        m_base = (ptr-9*len_mod+2*36)%36;
    }

    byte* Fugue384::GetResult()
    {
        uint row0, row1, row2, row3;
        uint col0, col1, col2, col3;
        uint tmp;
        uint j1 = (4-m_base/9)%4;
        int ptr = m_base;

        for (int j=0; j<6; j++) 
        {
            m_state[((-3*(3*((j1+j)%4)+1))+36)%36] ^= m_state[((-3*(3*((j1+j)%4)+1))+4+36)%36];
            m_state[((-3*(3*((j1+j)%4)+1))+1+36)%36] ^= m_state[((-3*(3*((j1+j)%4)+1))+5+36)%36];
            m_state[((-3*(3*((j1+j)%4)+1))+2+36)%36] ^= m_state[((-3*(3*((j1+j)%4)+1))+6+36)%36];
            m_state[((-3*(3*((j1+j)%4)+1))+18+36)%36] ^= m_state[((-3*(3*((j1+j)%4)+1))+4+36)%36];
            m_state[((-3*(3*((j1+j)%4)+1))+19+36)%36] ^= m_state[((-3*(3*((j1+j)%4)+1))+5+36)%36];
            m_state[((-3*(3*((j1+j)%4)+1))+20+36)%36] ^= m_state[((-3*(3*((j1+j)%4)+1))+6+36)%36];
            col0 = col1 = col2 = col3 = 0;
            row0 = row1 = row2 = row3 = 0;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*((j1+j)%4)+1))+36)%36])];
            col0 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*((j1+j)%4)+1))+36)%36]>>8)];
            row1 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*((j1+j)%4)+1))+36)%36]>>16)];
            row2 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*((j1+j)%4)+1))+36)%36]>>24)];
            row3 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*((j1+j)%4)+1))+1+36)%36])];
            row0 = tmp;
            col1 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*((j1+j)%4)+1))+1+36)%36]>>8)];
            col1 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*((j1+j)%4)+1))+1+36)%36]>>16)];
            row2 ^= tmp;
            col1 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*((j1+j)%4)+1))+1+36)%36]>>24)];
            row3 ^= tmp;
            col1 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*((j1+j)%4)+1))+2+36)%36])];
            row0 ^= tmp;
            col2 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*((j1+j)%4)+1))+2+36)%36]>>8)];
            row1 ^= tmp;
            col2 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*((j1+j)%4)+1))+2+36)%36]>>16)];
            col2 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*((j1+j)%4)+1))+2+36)%36]>>24)];
            row3 ^= tmp;
            col2 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*((j1+j)%4)+1))+3+36)%36])];
            row0 ^= tmp;
            col3 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*((j1+j)%4)+1))+3+36)%36]>>8)];
            row1 ^= tmp;
            col3 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*((j1+j)%4)+1))+3+36)%36]>>16)];
            row2 ^= tmp;
            col3 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*((j1+j)%4)+1))+3+36)%36]>>24)];
            col3 ^= tmp;
            m_state[((-3*(3*((j1+j)%4)+1))+36)%36]= ((row0^col0)&0x000000ff)^((row1^col1)&0x0000ff00)^((row2^col2)&0x00ff0000)^((row3^col3)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[((-3*(3*((j1+j)%4)+1))+1+36)%36]= ((row0^col1)&0x000000ff)^((row1^col2)&0x0000ff00)^((row2^col3)&0x00ff0000)^((row3^col0)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[((-3*(3*((j1+j)%4)+1))+2+36)%36]= ((row0^col2)&0x000000ff)^((row1^col3)&0x0000ff00)^((row2^col0)&0x00ff0000)^((row3^col1)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[((-3*(3*((j1+j)%4)+1))+3+36)%36]= ((row0^col3)&0x000000ff)^((row1^col0)&0x0000ff00)^((row2^col1)&0x00ff0000)^((row3^col2)&0xff000000);
            m_state[((-3*(3*((j1+j)%4)+2))+36)%36] ^= m_state[((-3*(3*((j1+j)%4)+2))+4+36)%36];
            m_state[((-3*(3*((j1+j)%4)+2))+1+36)%36] ^= m_state[((-3*(3*((j1+j)%4)+2))+5+36)%36];
            m_state[((-3*(3*((j1+j)%4)+2))+2+36)%36] ^= m_state[((-3*(3*((j1+j)%4)+2))+6+36)%36];
            m_state[((-3*(3*((j1+j)%4)+2))+18+36)%36] ^= m_state[((-3*(3*((j1+j)%4)+2))+4+36)%36];
            m_state[((-3*(3*((j1+j)%4)+2))+19+36)%36] ^= m_state[((-3*(3*((j1+j)%4)+2))+5+36)%36];
            m_state[((-3*(3*((j1+j)%4)+2))+20+36)%36] ^= m_state[((-3*(3*((j1+j)%4)+2))+6+36)%36];
            col0 = col1 = col2 = col3 = 0;
            row0 = row1 = row2 = row3 = 0;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*((j1+j)%4)+2))+36)%36])];
            col0 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*((j1+j)%4)+2))+36)%36]>>8)];
            row1 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*((j1+j)%4)+2))+36)%36]>>16)];
            row2 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*((j1+j)%4)+2))+36)%36]>>24)];
            row3 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*((j1+j)%4)+2))+1+36)%36])];
            row0 = tmp;
            col1 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*((j1+j)%4)+2))+1+36)%36]>>8)];
            col1 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*((j1+j)%4)+2))+1+36)%36]>>16)];
            row2 ^= tmp;
            col1 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*((j1+j)%4)+2))+1+36)%36]>>24)];
            row3 ^= tmp;
            col1 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*((j1+j)%4)+2))+2+36)%36])];
            row0 ^= tmp;
            col2 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*((j1+j)%4)+2))+2+36)%36]>>8)];
            row1 ^= tmp;
            col2 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*((j1+j)%4)+2))+2+36)%36]>>16)];
            col2 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*((j1+j)%4)+2))+2+36)%36]>>24)];
            row3 ^= tmp;
            col2 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*((j1+j)%4)+2))+3+36)%36])];
            row0 ^= tmp;
            col3 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*((j1+j)%4)+2))+3+36)%36]>>8)];
            row1 ^= tmp;
            col3 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*((j1+j)%4)+2))+3+36)%36]>>16)];
            row2 ^= tmp;
            col3 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*((j1+j)%4)+2))+3+36)%36]>>24)];
            col3 ^= tmp;
            m_state[((-3*(3*((j1+j)%4)+2))+36)%36]= ((row0^col0)&0x000000ff)^((row1^col1)&0x0000ff00)^((row2^col2)&0x00ff0000)^((row3^col3)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[((-3*(3*((j1+j)%4)+2))+1+36)%36]= ((row0^col1)&0x000000ff)^((row1^col2)&0x0000ff00)^((row2^col3)&0x00ff0000)^((row3^col0)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[((-3*(3*((j1+j)%4)+2))+2+36)%36]= ((row0^col2)&0x000000ff)^((row1^col3)&0x0000ff00)^((row2^col0)&0x00ff0000)^((row3^col1)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[((-3*(3*((j1+j)%4)+2))+3+36)%36]= ((row0^col3)&0x000000ff)^((row1^col0)&0x0000ff00)^((row2^col1)&0x00ff0000)^((row3^col2)&0xff000000);
            m_state[((-3*(3*((j1+j)%4)+3))+36)%36] ^= m_state[((-3*(3*((j1+j)%4)+3))+4+36)%36];
            m_state[((-3*(3*((j1+j)%4)+3))+1+36)%36] ^= m_state[((-3*(3*((j1+j)%4)+3))+5+36)%36];
            m_state[((-3*(3*((j1+j)%4)+3))+2+36)%36] ^= m_state[((-3*(3*((j1+j)%4)+3))+6+36)%36];
            m_state[((-3*(3*((j1+j)%4)+3))+18+36)%36] ^= m_state[((-3*(3*((j1+j)%4)+3))+4+36)%36];
            m_state[((-3*(3*((j1+j)%4)+3))+19+36)%36] ^= m_state[((-3*(3*((j1+j)%4)+3))+5+36)%36];
            m_state[((-3*(3*((j1+j)%4)+3))+20+36)%36] ^= m_state[((-3*(3*((j1+j)%4)+3))+6+36)%36];
            col0 = col1 = col2 = col3 = 0;
            row0 = row1 = row2 = row3 = 0;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*((j1+j)%4)+3))+36)%36])];
            col0 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*((j1+j)%4)+3))+36)%36]>>8)];
            row1 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*((j1+j)%4)+3))+36)%36]>>16)];
            row2 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*((j1+j)%4)+3))+36)%36]>>24)];
            row3 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*((j1+j)%4)+3))+1+36)%36])];
            row0 = tmp;
            col1 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*((j1+j)%4)+3))+1+36)%36]>>8)];
            col1 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*((j1+j)%4)+3))+1+36)%36]>>16)];
            row2 ^= tmp;
            col1 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*((j1+j)%4)+3))+1+36)%36]>>24)];
            row3 ^= tmp;
            col1 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*((j1+j)%4)+3))+2+36)%36])];
            row0 ^= tmp;
            col2 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*((j1+j)%4)+3))+2+36)%36]>>8)];
            row1 ^= tmp;
            col2 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*((j1+j)%4)+3))+2+36)%36]>>16)];
            col2 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*((j1+j)%4)+3))+2+36)%36]>>24)];
            row3 ^= tmp;
            col2 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[((-3*(3*((j1+j)%4)+3))+3+36)%36])];
            row0 ^= tmp;
            col3 = tmp;
            tmp = aes_style_table1[(byte)(m_state[((-3*(3*((j1+j)%4)+3))+3+36)%36]>>8)];
            row1 ^= tmp;
            col3 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[((-3*(3*((j1+j)%4)+3))+3+36)%36]>>16)];
            row2 ^= tmp;
            col3 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[((-3*(3*((j1+j)%4)+3))+3+36)%36]>>24)];
            col3 ^= tmp;
            m_state[((-3*(3*((j1+j)%4)+3))+36)%36]= ((row0^col0)&0x000000ff)^((row1^col1)&0x0000ff00)^((row2^col2)&0x00ff0000)^((row3^col3)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[((-3*(3*((j1+j)%4)+3))+1+36)%36]= ((row0^col1)&0x000000ff)^((row1^col2)&0x0000ff00)^((row2^col3)&0x00ff0000)^((row3^col0)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[((-3*(3*((j1+j)%4)+3))+2+36)%36]= ((row0^col2)&0x000000ff)^((row1^col3)&0x0000ff00)^((row2^col0)&0x00ff0000)^((row3^col1)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[((-3*(3*((j1+j)%4)+3))+3+36)%36]= ((row0^col3)&0x000000ff)^((row1^col0)&0x0000ff00)^((row2^col1)&0x00ff0000)^((row3^col2)&0xff000000);
        };

        ptr = ptr-18;

        for (int j=0; j<13; j++) 
        { 
            m_state[(ptr+4+36)%36] ^= m_state[(ptr+36)%36];
            m_state[(ptr+12+36)%36] ^= m_state[(ptr+36)%36];
            m_state[(ptr+24+36)%36] ^= m_state[(ptr+36)%36];
            ptr = ((ptr-12+36)%36);
            col0 = col1 = col2 = col3 = 0;
            row0 = row1 = row2 = row3 = 0;
            tmp = aes_style_table0[(byte)(m_state[(ptr+36)%36])];
            col0 = tmp;
            tmp = aes_style_table1[(byte)(m_state[(ptr+36)%36]>>8)];
            row1 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[(ptr+36)%36]>>16)];
            row2 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[(ptr+36)%36]>>24)];
            row3 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[(ptr+1+36)%36])];
            row0 = tmp;
            col1 = tmp;
            tmp = aes_style_table1[(byte)(m_state[(ptr+1+36)%36]>>8)];
            col1 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[(ptr+1+36)%36]>>16)];
            row2 ^= tmp;
            col1 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[(ptr+1+36)%36]>>24)];
            row3 ^= tmp;
            col1 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[(ptr+2+36)%36])];
            row0 ^= tmp;
            col2 = tmp;
            tmp = aes_style_table1[(byte)(m_state[(ptr+2+36)%36]>>8)];
            row1 ^= tmp;
            col2 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[(ptr+2+36)%36]>>16)];
            col2 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[(ptr+2+36)%36]>>24)];
            row3 ^= tmp;
            col2 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[(ptr+3+36)%36])];
            row0 ^= tmp;
            col3 = tmp;
            tmp = aes_style_table1[(byte)(m_state[(ptr+3+36)%36]>>8)];
            row1 ^= tmp;
            col3 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[(ptr+3+36)%36]>>16)];
            row2 ^= tmp;
            col3 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[(ptr+3+36)%36]>>24)];
            col3 ^= tmp;
            m_state[(ptr+36)%36]= ((row0^col0)&0x000000ff)^((row1^col1)&0x0000ff00)^((row2^col2)&0x00ff0000)^((row3^col3)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[(ptr+1+36)%36]= ((row0^col1)&0x000000ff)^((row1^col2)&0x0000ff00)^((row2^col3)&0x00ff0000)^((row3^col0)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[(ptr+2+36)%36]= ((row0^col2)&0x000000ff)^((row1^col3)&0x0000ff00)^((row2^col0)&0x00ff0000)^((row3^col1)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[(ptr+3+36)%36]= ((row0^col3)&0x000000ff)^((row1^col0)&0x0000ff00)^((row2^col1)&0x00ff0000)^((row3^col2)&0xff000000);
            m_state[(ptr+4+36)%36] ^= m_state[(ptr+36)%36];
            m_state[(ptr+13+36)%36] ^= m_state[(ptr+36)%36];
            m_state[(ptr+24+36)%36] ^= m_state[(ptr+36)%36];
            ptr = ((ptr-12+36)%36);
            col0 = col1 = col2 = col3 = 0;
            row0 = row1 = row2 = row3 = 0;
            tmp = aes_style_table0[(byte)(m_state[(ptr+36)%36])];
            col0 = tmp;
            tmp = aes_style_table1[(byte)(m_state[(ptr+36)%36]>>8)];
            row1 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[(ptr+36)%36]>>16)];
            row2 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[(ptr+36)%36]>>24)];
            row3 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[(ptr+1+36)%36])];
            row0 = tmp;
            col1 = tmp;
            tmp = aes_style_table1[(byte)(m_state[(ptr+1+36)%36]>>8)];
            col1 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[(ptr+1+36)%36]>>16)];
            row2 ^= tmp;
            col1 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[(ptr+1+36)%36]>>24)];
            row3 ^= tmp;
            col1 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[(ptr+2+36)%36])];
            row0 ^= tmp;
            col2 = tmp;
            tmp = aes_style_table1[(byte)(m_state[(ptr+2+36)%36]>>8)];
            row1 ^= tmp;
            col2 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[(ptr+2+36)%36]>>16)];
            col2 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[(ptr+2+36)%36]>>24)];
            row3 ^= tmp;
            col2 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[(ptr+3+36)%36])];
            row0 ^= tmp;
            col3 = tmp;
            tmp = aes_style_table1[(byte)(m_state[(ptr+3+36)%36]>>8)];
            row1 ^= tmp;
            col3 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[(ptr+3+36)%36]>>16)];
            row2 ^= tmp;
            col3 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[(ptr+3+36)%36]>>24)];
            col3 ^= tmp;
            m_state[(ptr+36)%36]= ((row0^col0)&0x000000ff)^((row1^col1)&0x0000ff00)^((row2^col2)&0x00ff0000)^((row3^col3)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[(ptr+1+36)%36]= ((row0^col1)&0x000000ff)^((row1^col2)&0x0000ff00)^((row2^col3)&0x00ff0000)^((row3^col0)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[(ptr+2+36)%36]= ((row0^col2)&0x000000ff)^((row1^col3)&0x0000ff00)^((row2^col0)&0x00ff0000)^((row3^col1)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[(ptr+3+36)%36]= ((row0^col3)&0x000000ff)^((row1^col0)&0x0000ff00)^((row2^col1)&0x00ff0000)^((row3^col2)&0xff000000);
            m_state[(ptr+4+36)%36] ^= m_state[(ptr+36)%36];
            m_state[(ptr+13+36)%36] ^= m_state[(ptr+36)%36];
            m_state[(ptr+25+36)%36] ^= m_state[(ptr+36)%36];
            ptr = ((ptr-11+36)%36);
            col0 = col1 = col2 = col3 = 0;
            row0 = row1 = row2 = row3 = 0;
            tmp = aes_style_table0[(byte)(m_state[(ptr+36)%36])];
            col0 = tmp;
            tmp = aes_style_table1[(byte)(m_state[(ptr+36)%36]>>8)];
            row1 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[(ptr+36)%36]>>16)];
            row2 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[(ptr+36)%36]>>24)];
            row3 = tmp;
            col0 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[(ptr+1+36)%36])];
            row0 = tmp;
            col1 = tmp;
            tmp = aes_style_table1[(byte)(m_state[(ptr+1+36)%36]>>8)];
            col1 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[(ptr+1+36)%36]>>16)];
            row2 ^= tmp;
            col1 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[(ptr+1+36)%36]>>24)];
            row3 ^= tmp;
            col1 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[(ptr+2+36)%36])];
            row0 ^= tmp;
            col2 = tmp;
            tmp = aes_style_table1[(byte)(m_state[(ptr+2+36)%36]>>8)];
            row1 ^= tmp;
            col2 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[(ptr+2+36)%36]>>16)];
            col2 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[(ptr+2+36)%36]>>24)];
            row3 ^= tmp;
            col2 ^= tmp;
            tmp = aes_style_table0[(byte)(m_state[(ptr+3+36)%36])];
            row0 ^= tmp;
            col3 = tmp;
            tmp = aes_style_table1[(byte)(m_state[(ptr+3+36)%36]>>8)];
            row1 ^= tmp;
            col3 ^= tmp;
            tmp = aes_style_table2[(byte)(m_state[(ptr+3+36)%36]>>16)];
            row2 ^= tmp;
            col3 ^= tmp;
            tmp = aes_style_table3[(byte)(m_state[(ptr+3+36)%36]>>24)];
            col3 ^= tmp;
            m_state[(ptr+36)%36]= ((row0^col0)&0x000000ff)^((row1^col1)&0x0000ff00)^((row2^col2)&0x00ff0000)^((row3^col3)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[(ptr+1+36)%36]= ((row0^col1)&0x000000ff)^((row1^col2)&0x0000ff00)^((row2^col3)&0x00ff0000)^((row3^col0)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[(ptr+2+36)%36]= ((row0^col2)&0x000000ff)^((row1^col3)&0x0000ff00)^((row2^col0)&0x00ff0000)^((row3^col1)&0xff000000);
            row0 = ((row0<<24)|(row0>>8));
            row1 = ((row1<<24)|(row1>>8));
            row2 = ((row2<<24)|(row2>>8));
            row3 = ((row3<<24)|(row3>>8));
            m_state[(ptr+3+36)%36]= ((row0^col3)&0x000000ff)^((row1^col0)&0x0000ff00)^((row2^col1)&0x00ff0000)^((row3^col2)&0xff000000);
        }

        m_state[(ptr+4+36)%36] ^= m_state[(ptr+36)%36];
        m_state[(ptr+12+36)%36] ^= m_state[(ptr+36)%36];
        m_state[(ptr+24+36)%36] ^= m_state[(ptr+36)%36];

        byte* result = new byte[HashSize];

        for (int j=0; j<4; j++)
        {
            ((uint*)result)[j] = m_state[(ptr+1+j+36)%36];
            ((uint*)result)[4+j] = m_state[(ptr+12+j+36)%36];
            ((uint*)result)[8+j] = m_state[(ptr+24+j+36)%36];
        }

        return result;
    }
}